(FILECREATED "27-JUL-83 16:41:08" {PHYLUM}<FIKES>LISP>DESCRIBEJOB.;41 52094 changes to: (FNS ProceedFromPanel HelpFromPanel) previous date: "26-JUL-83 17:27:43" {PHYLUM}<FIKES>LISP>DESCRIBEJOB.;40) (PRETTYCOMPRINT DESCRIBEJOBCOMS) (RPAQQ DESCRIBEJOBCOMS [(VARS (NumberOfCopiesTimer 0) (NumberOfOriginalsTimer 0)) (RECORDS * DESCRIBEJOBRECORDS) (FNS * DESCRIBEJOBFNS) (DECLARE: EVAL@COMPILE (P (LOADCOMP? 'LOADBLUEBONNET]) (RPAQQ NumberOfCopiesTimer 0) (RPAQQ NumberOfOriginalsTimer 0) (RPAQQ DESCRIBEJOBRECORDS (Derivation JobPanelField SelectableItem)) [DECLARE: EVAL@COMPILE (DATATYPE Derivation (resultField resultValue constraint givens)) (DATATYPE JobPanelField (queryItem valueItems internalUnionRegion selectedItem field visibleFlg) [ACCESSFNS ((unionRegion [OR (fetch internalUnionRegion of DATUM) (replace internalUnionRegion of DATUM with (APPLY (QUOTE UNIONREGIONS) (CONS (fetch itemRegion of (fetch queryItem of DATUM)) (for i in (fetch valueItems of DATUM) collect (fetch itemRegion of i] (replace internalUnionRegion of DATUM with NEWVALUE]) (DATATYPE SelectableItem (itemRegion jobPanelField itemValue invertedFlg) jobPanelField ←(create JobPanelField)) ] (/DECLAREDATATYPE (QUOTE Derivation) (QUOTE (POINTER POINTER POINTER POINTER))) (/DECLAREDATATYPE (QUOTE JobPanelField) (QUOTE (POINTER POINTER POINTER POINTER POINTER POINTER))) (/DECLAREDATATYPE (QUOTE SelectableItem) (QUOTE (POINTER POINTER POINTER POINTER))) (RPAQQ DESCRIBEJOBFNS (AddAssertion AddDerivation Advise1To2 Advise2To1WithMaster AdviseBdaWithMaster ApplyHelpUnits CommentOnJob CopyCopyJob CopyingTime CreateFieldItems DefineDefaultJob DeriveValue DeriveValuesForGenerators DerivedResult? DeselectItem EraseJobPanelField FindEnabledGenerators FlashQuery FlipItem FlipRegion GeneratorsTimeEstimate GetGeneratorParameters GiveUserQueryHelp HelpFromPanel InItem? InitiateDescriptionPanel JobFieldValue JobPanelButtonHandler JobPanelHelpHandler PrintAndBox PrintComment ProceedFromPanel RedisplayJobPanelField RedisplayMenu RedisplayMenuTitle RefreshPanel RelevantField? RemoveDerivationsOf RemoveValue ResolveNewJobValue SecondsToRoundedMinutes SelectItem SelectPlanGenerator SetJobField ShowTimeEstimate Subset? SupportsForDerivation TimeEstimateForJob TimeFor1To1 TimeFor1To2 TimeFor2To1WithMaster TimeForBdaNoMaster TimeForBdaWithMaster TimeForPlanners TimeForTooThick TimeToCollate TimeToReverseOriginals TimeToStaple UpdateJobField UpdateJobDescriptionPanel WhenNumberOfCopiesMenuSelected WhenOriginalsMenuSelected WhenPadMenuSelected)) (DEFINEQ (AddAssertion [LAMBDA (job field value) (* edited: "10-MAR-83 13:34") (* Give field a new value in job. If field had a value, then use RemoveValue to first remove it. Return the new value.) (if (JobFieldValue field job) ~=value then (\TraceIt BluebonnetTrace "Assertion: " field " ← " value) (RemoveValue field job) (SetJobField job field value) else (RemoveDerivationsOf field job)) value]) (AddDerivation [LAMBDA (derivation job) (* edited: "10-MAR-83 13:34") (* Assign the result value to the result field as specified by the derivation and add the derivation to job. Use RemoveValue to remove any existing value for the result field. Return derivation.) (if (JobFieldValue derivation:resultField job) ~=derivation:resultValue then (\TraceIt BluebonnetTrace "Derivaton: " derivation:resultField " ← " derivation:resultValue)) (RemoveValue derivation:resultField job) (if derivation:resultValue then (SetJobField job derivation:resultField derivation:resultValue) job:derivations← <derivation ! job:derivations> derivation]) (Advise1To2 [LAMBDA (job) (* edited: " 1-FEB-83 11:52") (* Provide an advise comment to the user about doing 1 to 2 sided copying.) T]) (Advise2To1WithMaster [LAMBDA NIL (* edited: "11-MAR-83 13:52") NIL]) (AdviseBdaWithMaster [LAMBDA (job) (* ref: "26-JUL-83 17:15") (* Provide an advise comment to the user about using the BDA to make a master.) (PROG (difference minutes hours subJobTime (collate? (AND job:Collate=(QUOTE Yes) job:NumberOfCopies job:NumberOfCopies~=1)) (staple? (AND job:Staple=(QUOTE Yes) job:CopiesTooThickToStaple=(QUOTE No))) (twoSidedCopies? (job:TwoSidedCopies=(QUOTE Yes))) (subJob (CopyCopyJob job))) (subJob:Collate←(QUOTE No)) (subJob:Staple←(QUOTE No)) (subJob:TwoSidedCopies←(QUOTE No)) (subJobTime←(TimeForBdaNoMaster subJob)) (if subJobTime and job:timeEstimate then subJobTime←subJobTime+(TimeToCollate job)+(TimeToStaple job) difference←job:timeEstimate-subJobTime (if difference gt 120 or (FQUOTIENT difference job:timeEstimate) gt .2 then subJobTime←(SecondsToRoundedMinutes subJobTime) hours←subJobTime/60 minutes←(IREMAINDER subJobTime 60) (PrintComment [BQUOTE (You could save yourself ,@[COND ((IGREATERP difference 120) (BQUOTE (about , (SecondsToRoundedMinutes difference) minutes))) (T (QUOTE (some time] by ,@[COND (twoSidedCopies? (BQUOTE (making one-sided ,@(COND ((OR collate? staple?) (QUOTE (copies, and))) (T (QUOTE (copies.] ,@[COND (staple? (QUOTE (stapling] ,@[COND (collate? (BQUOTE (,@[COND (staple? (QUOTE (and] collating] ,@(COND ((OR collate? staple?) (QUOTE (the copies yourself.] T]) (ApplyHelpUnits [LAMBDA (job) (* ref: "26-JUL-83 17:07") (* Test each help unit for applicability and apply those whose wff is true.) (for unit in HelpUnits when (EvalWff unit:HelpUnit.wff job) do (PrintComment unit:HelpUnit.text) (for ch in unit:HelpUnit.changes do (FlashQuery job ch)) (RETURN]) (CommentOnJob [LAMBDA (job) (* edited: "14-JAN-83 14:55") (* Display in the comment window the messages of any comment wff that is true.) (CLEARW CommentWindow) (for w in CommentWffs when (EvalWff w:Constraint.wff job) do (PrintComment w:Constraint.text T]) (CopyCopyJob [LAMBDA (job) (* edited: " 4-FEB-83 13:28") (* Make a copy of a copy job. Do not copy any of the field values.) (PROG ((newJob (create CopyJob))) (for f in (RECORDFIELDNAMES (QUOTE CopyJob)) do (RECORDACCESS f newJob CopyJobRecord (QUOTE replace) (JobFieldValue f job))) (RETURN newJob]) (CopyingTime [LAMBDA (job) (* edited: " 2-FEB-83 13:50") (* Estimate the copying time in seconds for this job.) job:NumberOfCopies*job:#OfOriginalSheets*.86]) (CreateFieldItems [LAMBDA (field job window indentation) (* edited: " 2-FEB-83 10:50") (* Create the items for copy job field for job in window. Return the list of items.) (PROG (vItem qItem jpf) (TERPRI window) (TERPRI window) (qItem←(create SelectableItem itemRegion ←(PrintAndBox (GETP field (QUOTE query)) window indentation))) (jpf←qItem:jobPanelField) (WINDOWPROP window field jpf) (jpf:queryItem←qItem) (jpf:JobPanelField.field←field) (jpf:valueItems←(for v in (GETP field (QUOTE valueRange)) collect (SPACES 4 window) (vItem←(create SelectableItem itemRegion ←(PrintAndBox v window) jobPanelField ← jpf itemValue ← v)) (if v=(RECORDACCESS field job (RECLOOK (QUOTE CopyJob))) then (SelectItem vItem window)) vItem)) (jpf:visibleFlg←T) (if ~(RelevantField? field job) then (EraseJobPanelField jpf window)) (RETURN (COPY jpf:valueItems]) (DefineDefaultJob [LAMBDA (job) (* edited: "31-JAN-83 13:37") (* Assert the values that define a default copy job. If job is NIL, then create a copy job. Return the job.) (if job then (job:relevantFields←NIL) else job←(create CopyJob)) job:relevantFields←(for spec in (QUOTE (#OfOriginalSheets CopiesOnStandardPaper CopyBrightness NumberOfCopies OriginalsBound OriginalsOnStandardPaper OriginalsStandardSize Staple TwoSidedCopies TwoSidedOriginals)) collect (AddAssertion job spec (GETPROP spec (QUOTE defaultValue))) spec) (ResolveNewJobValue job (QUOTE Reduction) (GETPROP (QUOTE Reduction) (QUOTE defaultValue))) job]) (DeriveValue [LAMBDA (field job fieldsBeingDerived) (* edited: "12-MAR-83 16:31") (* Use field's derivers to derive a value for field in job. If successful, return the support list for the derivation. If not, return the shortest support list for all of the deriver evaluations. Assume field is unvalued in job. fieldsBeingDerived is a list of fields that DeriveValue is being used to derive. It acts as a goal stack for recursive calls to DeriveValue and is used to prevent looping.) (PROG (val support unprocessedDerivers) (for deriver in (GETPROP field (QUOTE derivers)) do (if (for f in deriver:otherFields always (JobFieldValue f job)) then val←(EvalCompactOr deriver:compactOr job T) (if val:1 then (push support val::1) else (AddDerivation (create Derivation resultField ← field resultValue ←(EvalWff deriver:value job) constraint ← deriver:Deriver.constraint givens ← deriver:otherFields) job) (RETFROM (QUOTE DeriveValue) (SupportsForDerivation field job))) else (push unprocessedDerivers deriver))) (RETURN (for deriver in unprocessedDerivers bind (newGoalStack ← <field ! fieldsBeingDerived>) do (for f in deriver:otherFields unless (JobFieldValue f job) or f MEMB fieldsBeingDerived do (DeriveValue f job newGoalStack)) (val←(EvalCompactOr deriver:compactOr job T)) (if val:1 then (push support val::1) elseif (for f in deriver:otherFields always (JobFieldValue f job)) then (AddDerivation (create Derivation resultField ← field resultValue ←(EvalWff deriver:value job) constraint ← deriver:Deriver.constraint givens ← deriver:otherFields) job) (RETURN (SupportsForDerivation field job))) finally (RETURN (ShortestSupport (CombineSupports (for struc in support collect (for sList in struc collect (for s in sList join ( SupportsForDerivation s job) or <s>]) (DeriveValuesForGenerators [LAMBDA (job) (* edited: " 4-FEB-83 15:08") (* Determine the enabled generators for this job and use the derivation constraints to determine values for unvalued fields relevant to the generator determination. If the constraints do not provide a value for a field assign its previous value or if none its default value. Return a dotted pair, the first element of which is a list of enabled generators, and the second element is a list of relevant fields.) (PROG (gens unprocessedFields newValue? newSupportValue? relevantFields supports) [repeatwhile newValue? do (newValue?←relevantFields←NIL) (gens←(FindEnabledGenerators job)) (unprocessedFields←gens::1) (for f in unprocessedFields do (if (JobFieldValue f job) then (pushlist relevantFields (SupportsForDerivation f job)) else (repeatwhile newSupportValue? do (newSupportValue?←NIL) (supports←(DeriveValue f job)) (if (JobFieldValue f job) then newValue?←(pushlist relevantFields supports) else (for s in supports unless (JobFieldValue s job) do newSupportValue?←([AddAssertion job s (OR (LISTGET job:removedAssertions s) (GETPROP s (QUOTE defaultValue] or newSupportValue?)) (if ~newSupportValue? then (push relevantFields f) (if [AddAssertion job f (OR (LISTGET job:removedAssertions f) (GETPROP f (QUOTE defaultValue] then newValue?←T else (pushlist relevantFields supports] [for f in (for g in gens:1 join (GetGeneratorParameters g job)) do (if (JobFieldValue f job) then (pushlist relevantFields (SupportsForDerivation f job)) else (repeatwhile newSupportValue? do (newSupportValue?←NIL) (supports←(DeriveValue f job)) (if (JobFieldValue f job) then (pushlist relevantFields supports) else (for s in supports unless (JobFieldValue s job) do newSupportValue?←([AddAssertion job s (OR (LISTGET job:removedAssertions s) (GETPROP s (QUOTE defaultValue] or newSupportValue?)) (if ~newSupportValue? then (push relevantFields f) (if ~[AddAssertion job f (OR (LISTGET job:removedAssertions f) (GETPROP f (QUOTE defaultValue] then (pushlist relevantFields supports] (RETURN <gens:1 ! relevantFields>]) (DerivedResult? [LAMBDA (field job) (* ref: " 9-JUN-82 10:48") (* Determine whether field is a result field of any derivations in job. Return the list of derivations.) (for d in job:derivations when d:resultField=field collect d]) (DeselectItem [LAMBDA (item window) (* ref: "26-MAY-82 15:57") (* deselects item from window) (if item and item:jobPanelField:selectedItem=item then (FlipItem item window) item:jobPanelField:selectedItem←NIL]) (EraseJobPanelField [LAMBDA (jpField window) (* ref: " 1-JUN-82 15:44") (* White out the regions of the given job panel field in window.) (if jpField and jpField:visibleFlg then (DSPFILL jpField:unionRegion WHITESHADE 'REPLACE window) jpField:visibleFlg←NIL jpField:selectedItem←NIL]) (FindEnabledGenerators [LAMBDA (job) (* edited: " 2-FEB-83 11:37") (* Return a dotted pair the first element of which is a list of plan generators whose enabling conditions are satisfied by job, the second of which is a list of fields that support the evaluation of the enabling conditions.) (PROG (support generators val) (for gen in PlanGenerators do (val←(EvalWff gen:enablingCondition job T)) (if val:1 then (push generators gen)) (push support val::1)) (RETURN <generators !(ShortestSupport (CombineSupports support)) >]) (FlashQuery [LAMBDA (job field) (* edited: " 2-FEB-83 11:10") (* Flash the field's query on the job description panel.) (for i to 5 bind ((panel ← job:descriptionPanel) item) first item←(fetch queryItem of (WINDOWPROP panel field)) do (FlipItem item panel) (DISMISS 250]) (FlipItem [LAMBDA (item ds) (* ref: "30-AUG-82 17:59") (* flips the region of an item) (FlipRegion item:itemRegion ds) item:invertedFlg←~(item : invertedFlg]) (FlipRegion [LAMBDA (reg ds) (* ref: "16-JUN-82 14:20") (* flips a region.) (BITBLT NIL NIL NIL ds reg:LEFT reg:BOTTOM reg:WIDTH reg:HEIGHT 'TEXTURE 'INVERT BLACKSHADE]) (GeneratorsTimeEstimate [LAMBDA (gen job) (* ref: "26-JUL-83 15:27") (* Use the plan generator's time estimator to determine a time estimate for doing the job.) (if gen:timeEstimator then (APPLY* gen:timeEstimator job]) (GetGeneratorParameters [LAMBDA (gen job) (* edited: " 4-FEB-83 07:49") (* Return a list of copy job fields that this plan generator uses to construct its plan.) (OR (LISTP gen:parameters) (APPLY* gen:parameters job]) (GiveUserQueryHelp [LAMBDA (job field queryItem) (* edited: "28-JAN-83 15:52") (* Print a help message for the given field in the comment window.) (PrintComment (OR (GETPROP field (QUOTE helpMessage)) DefaultQueryHelpMessage)) (WINDOWPROP job:descriptionPanel (QUOTE BUTTONEVENTFN) (QUOTE JobPanelButtonHandler]) (HelpFromPanel [LAMBDA (panel) (* edited: "27-JUL-83 14:19") (* Help function for the job description panel.) (ALLOW.BUTTON.EVENTS) (PrintComment (QUOTE (Select the question you would like help with.))) (WINDOWPROP panel (QUOTE BUTTONEVENTFN) (QUOTE JobPanelHelpHandler]) (InItem? [LAMBDA (items pos) (* ref: "20-MAY-82 12:34") (PROG ((XPOS (pos:XCOORD)) (YPOS (pos:YCOORD))) (RETURN (for ITEM in items when ITEM:itemRegion and (INSIDE? ITEM:itemRegion XPOS YPOS) do (RETURN ITEM]) (InitiateDescriptionPanel [LAMBDA (copyJob) (* edited: "13-MAR-83 23:23") (* Create a job description panel and comment window for copyJob. Return the description panel.) (PROG [originalsItem yPos numberItem padMenu originalsMenu font jpField (w (CREATEW (create REGION LEFT ← 10 BOTTOM ← 0 WIDTH ← 700 HEIGHT ← 808] (WINDOWPROP w (QUOTE RIGHTBUTTONFN) (FUNCTION [LAMBDA NIL NIL])) (MOVETOUPPERLEFT w) (DSPFONT TimesRomanD24 w) (printout w "Describe the document to be copied:") (DSPFONT Gacha12Bold w) (WINDOWPROP w (QUOTE SelectableItems) (for f in OriginalsFields join (CreateFieldItems f copyJob w 5))) (printout w T T) (font←(DSPFONT Gacha12Bold WindowTitleDisplayStream)) (yPos←(DSPYPOSITION NIL w)) (originalsMenu←(create MENU MENUFONT ← Gacha12Bold ITEMS ←(QUOTE (1 2 3 4 5 6 7 8 9 "" 0 Clear)) CENTERFLG ← T MENUCOLUMNS ← 3 ITEMHEIGHT ← 25 ITEMWIDTH ← 40 TITLE ←(GETPROP (QUOTE #OfOriginalSheets) (QUOTE defaultValue)) WHENSELECTEDFN ←(QUOTE WhenOriginalsMenuSelected))) (WINDOWPROP w (QUOTE #OfOriginalSheetsMenu) originalsMenu) (RELMOVETO 0 (-(originalsMenu:IMAGEHEIGHT/2)) w) (originalsItem←(create SelectableItem itemRegion ←(PrintAndBox (GETPROP (QUOTE #OfOriginalSheets) (QUOTE query)) w 5))) (originalsItem:jobPanelField:JobPanelField.field←(QUOTE #OfOriginalSheets)) (originalsItem:jobPanelField:queryItem←originalsItem) (originalsItem:jobPanelField:visibleFlg←T) (WINDOWPROP w (QUOTE #OfOriginalSheets) originalsItem:jobPanelField) (originalsMenu:MENUPOSITION←(create POSITION XCOORD ←( originalsItem:itemRegion:LEFT+originalsItem:itemRegion:WIDTH+10) YCOORD ←(yPos-originalsMenu:IMAGEHEIGHT))) (ADDMENU originalsMenu w) (MOVETO 0 originalsMenu:MENUGRID:REGION.BOTTOM-5 w) (DSPFONT TimesRomanD24 w) (printout w T "Describe the desired copies:") (DSPFONT Gacha12Bold w) (printout w T) (yPos←(DSPYPOSITION NIL w)) (padMenu←(create MENU MENUFONT ← Gacha12Bold ITEMS ←(QUOTE (1 2 3 4 5 6 7 8 9 "" 0 Clear)) CENTERFLG ← T MENUCOLUMNS ← 3 ITEMHEIGHT ← 25 ITEMWIDTH ← 40 TITLE ←(GETPROP (QUOTE NumberOfCopies) (QUOTE defaultValue)) WHENSELECTEDFN ←(QUOTE WhenNumberOfCopiesMenuSelected))) (WINDOWPROP w (QUOTE NumberOfCopiesMenu) padMenu) (RELMOVETO 0 (-(padMenu:IMAGEHEIGHT/2)) w) (numberItem←(create SelectableItem itemRegion ←(PrintAndBox (GETPROP (QUOTE NumberOfCopies) (QUOTE query)) w 5))) (numberItem:jobPanelField:JobPanelField.field←(QUOTE NumberOfCopies)) (numberItem:jobPanelField:queryItem←numberItem) (numberItem:jobPanelField:visibleFlg←T) (WINDOWPROP w (QUOTE NumberOfCopies) numberItem:jobPanelField) (padMenu:MENUPOSITION←(create POSITION XCOORD ←( numberItem:itemRegion:LEFT+numberItem:itemRegion:WIDTH+10) YCOORD ←(yPos-padMenu:IMAGEHEIGHT))) (ADDMENU padMenu w) (DSPFONT font WindowTitleDisplayStream) (MOVETO 0 padMenu:MENUGRID:REGION.BOTTOM-5 w) (WINDOWPROP w (QUOTE SelectableItems) < !(WINDOWPROP w (QUOTE SelectableItems)) !(for f in CopiesFields join (CreateFieldItems f copyJob w 5)) >) (printout w .SKIP 4) (ADDMENU [create MENU MENUFONT ← Gacha12Bold ITEMS ←(QUOTE ("" % HELP% "")) WHENSELECTEDFN ←(FUNCTION (LAMBDA (item menu) (HelpFromPanel (WFROMMENU menu] w (create POSITION XCOORD ← 400 YCOORD ←(DSPYPOSITION NIL w))) (ADDMENU [create MENU MENUFONT ← Gacha12Bold ITEMS ←(QUOTE ("" PROCEED "")) WHENSELECTEDFN ←(FUNCTION (LAMBDA (item menu) (ProceedFromPanel (WFROMMENU menu] w (create POSITION XCOORD ← 160 YCOORD ←(DSPYPOSITION NIL w))) (WINDOWPROP w (QUOTE BUTTONEVENTFN) (FUNCTION JobPanelButtonHandler)) (WINDOWPROP w (QUOTE SelectableQueryItems) (for f in CopyJobFields when jpField←(WINDOWPROP w f) collect jpField:queryItem) ) (RETURN w]) (JobFieldValue [LAMBDA (field job) (* edited: " 7-FEB-83 12:40") (* Fetch the value of field in job.) (SELECTQ field (#OfCopySheets job:#OfCopySheets) (#OfOriginalSheets job:#OfOriginalSheets) (Collate job:Collate) (CopiesOnStandardPaper job:CopiesOnStandardPaper) (CopiesTooThickToStaple job:CopiesTooThickToStaple) (CopyBrightness job:CopyBrightness) (InputProcessor job:InputProcessor) (NumberOfCopies job:NumberOfCopies) (OriginalTooThick job:OriginalTooThick) (OriginalsBound job:OriginalsBound) (OriginalsOnStandardPaper job:OriginalsOnStandardPaper) (OriginalsPaperTooFragileOrThick job:OriginalsPaperTooFragileOrThick) (OriginalsStandardSize job:OriginalsStandardSize) (OriginalsTooLarge job:OriginalsTooLarge) (OriginalsTooSmall job:OriginalsTooSmall) (Reduction job:CopyJob.Reduction) (Staple job:Staple) (TwoSidedCopies job:TwoSidedCopies) (TwoSidedOriginals job:TwoSidedOriginals) (Unbindable job:Unbindable) (RECORDACCESS field job CopyJobRecord]) (JobPanelButtonHandler [LAMBDA (window) (* edited: " 6-FEB-83 20:05") (* selects a SelectableItem from the window. If there is an item selected already, it is deselected.) (PROG [now previous oldValue cursor (SelectableItems (WINDOWPROP window (QUOTE SelectableItems))) (reg (WINDOWPROP window (QUOTE REGION] (while (LASTMOUSESTATE (OR LEFT MIDDLE)) and (INSIDE? reg LASTMOUSEX LASTMOUSEY) do (TOTOPW window) (MENUBUTTONFN window) (now←(InItem? SelectableItems (CURSORPOSITION NIL window))) (if now and ~previous then previous←now:jobPanelField:selectedItem) (if previous and previous~=now then (DeselectItem previous window) oldValue←(JobFieldValue previous:jobPanelField:JobPanelField.field (WINDOWPROP window (QUOTE CopyJob))) (if oldValue and (~now or now:jobPanelField~=previous:jobPanelField) then (SelectItem (for i in previous:jobPanelField:valueItems thereis i:itemValue=oldValue) window))) (if now and now~=previous then (SelectItem now window)) (previous←now) (GETMOUSESTATE)) (if now then cursor←(CURSOR WAITINGCURSOR) (UpdateJobField (WINDOWPROP window (QUOTE CopyJob)) now:jobPanelField:JobPanelField.field now:itemValue) (CURSOR cursor)) (RETURN]) (JobPanelHelpHandler [LAMBDA (window) (* edited: " 6-FEB-83 20:10") (* selects a SelectableItem from the window. If there is an item selected already, it is deselected.) (PROG [now previous oldValue (SelectableItems (WINDOWPROP window (QUOTE SelectableQueryItems))) (reg (WINDOWPROP window (QUOTE REGION))) (relevantFields (fetch relevantFields of (WINDOWPROP window (QUOTE CopyJob] (while (LASTMOUSESTATE (OR LEFT MIDDLE)) and (INSIDE? reg LASTMOUSEX LASTMOUSEY) do (TOTOPW window) (now←(InItem? SelectableItems (CURSORPOSITION NIL window))) (now←(if now and now:jobPanelField:JobPanelField.field MEMB relevantFields then now)) (if previous and previous~=now then (FlipItem previous window)) (if now and now~=previous and ~(now : invertedFlg) then (FlipItem now window)) (previous←now) (GETMOUSESTATE)) (if now then (GiveUserQueryHelp (WINDOWPROP window (QUOTE CopyJob)) now:jobPanelField:JobPanelField.field now)) (RETURN]) (PrintAndBox [LAMBDA (exp window indentation) (* ref: "21-MAY-82 15:13") (* Indents indentation spaces, prints exp on window, and returns the box taken by the characters.) (PROG (left dsfont (ds (\SFInsureDisplayStream window))) (SPACES (OR indentation 0) window) (left←(DSPXPOSITION NIL ds)) (DSPRIGHTMARGIN 50000 ds) (* so that it won't auto carrage return. This should be resetsaved.) (PRIN1 exp ds) (dsfont←(DSPFONT NIL ds)) (RETURN (create REGION LEFT ← left BOTTOM ←((DSPYPOSITION NIL ds) -(FONTPROP dsfont 'DESCENT)) HEIGHT ←(FONTPROP dsfont 'HEIGHT) WIDTH ←((DSPXPOSITION NIL ds) -left]) (PrintComment [LAMBDA (text dontClearFlg) (* edited: "14-JAN-83 13:35") (* Print the text in the comment window. Clear the window first when dontClearFlg is NIL. text can be text for a paragraph or a paragraph.) (if ~dontClearFlg then (CLEARW CommentWindow)) (PrintParagraph CommentWindow (if (type? Paragraph text) then text else (create Paragraph text ← text]) (ProceedFromPanel [LAMBDA (panel) (* edited: "27-JUL-83 14:18") (* Respond to the user pushing the "PROCEED" button on the job description panel.) (PROG [planGenerator unvaluedFields plan (job (WINDOWPROP panel (QUOTE CopyJob] (ALLOW.BUTTON.EVENTS) (unvaluedFields←(for f in job:relevantFields unless (JobFieldValue f job) collect f)) (RETURN (if unvaluedFields then (PrintComment (QUOTE (Answer the indicated questions.))) (for f in unvaluedFields do (FlashQuery (WINDOWPROP panel f) panel)) else planGenerator←(job:planGenerator or (ResolveNewJobValue job (QUOTE NumberOfCopies) job:CopyJob.NumberOfCopies)) (if planGenerator and planGenerator:generator then (\TraceIt BluebonnetTrace "Create Procedure for Job.") plan←(APPLY* planGenerator:generator job) (if (type? Plan plan) then (\TraceIt BluebonnetTrace "Perform the procedure.") job:CopyJob.plan←plan (CLOSEW CopyJob:descriptionPanel) (CLOSEW CommentWindow) (DoPlan plan job) (CLOSEW UserInstructionWindow) (CLOSEW StatusWindow) (CLOSEW HelpWindow) (DELETEMENU (WINDOWPROP HelpWindow (QUOTE HelpMenu)) T) (StartBluebonnet)) else (PrintComment (QUOTE (Bluebonnet does not have a procedure for doing the job you described. Please check the job description and try again.]) (RedisplayJobPanelField [LAMBDA (jpField window) (* edited: " 2-FEB-83 10:55") (* Redisplay in window the query and values for the given job panel field.) (if jpField and [~(jpField : visibleFlg) or jpField:queryItem:invertedFlg or ~(jpField : selectedItem) and (JobFieldValue jpField:JobPanelField.field (WINDOWPROP window (QUOTE CopyJob] then (PROG [[fieldValue (JobFieldValue jpField:JobPanelField.field (WINDOWPROP window (QUOTE CopyJob] (region (jpField:queryItem:itemRegion)) (fontDescent (FONTPROP (DSPFONT NIL window) (QUOTE DESCENT] (MOVETO region:LEFT region:BOTTOM+fontDescent window) (printout window (GETPROP jpField:JobPanelField.field (QUOTE query))) (jpField:queryItem:invertedFlg←NIL) (jpField:selectedItem←NIL) (for item in jpField:valueItems do (region←item:itemRegion) (MOVETO region:LEFT region:BOTTOM+fontDescent window) (printout window item:itemValue) (if item:itemValue=fieldValue then (SelectItem item window))) (jpField:visibleFlg←T]) (RedisplayMenu [LAMBDA (menu window) (* ref: " 1-JUN-82 14:23") (* Redisplay menu in window.) (PROG ((x (menu:MENU.MENUGRID:REGION.LEFT)) (y (menu:MENU.MENUGRID:REGION.BOTTOM))) (UPDATE/MENU/IMAGE menu) (menu:MENUGRID:REGION.LEFT←x) (menu:MENUGRID:REGION.BOTTOM←y) (BLTMENUIMAGE menu (WINDOWPROP window 'DSP]) (RedisplayMenuTitle [LAMBDA (menu title font) (* edited: " 1-FEB-83 13:02") (* Redisplay the menu with the new title in the given font. Return title.) (PROG ((oldFont (DSPFONT font WindowTitleDisplayStream))) (menu:MENU.TITLE←title) (RedisplayMenu menu (WFROMMENU menu)) (DSPFONT oldFont WindowTitleDisplayStream) (RETURN title]) (RefreshPanel [LAMBDA NIL (* ref: "10-JUN-82 14:32") (* Redisplay the relevant queries for CopyJob's description panel.) (UpdateJobDescriptionPanel CopyJob:descriptionPanel T]) (RelevantField? [LAMBDA (field job) (* edited: "18-JAN-83 17:34") (* Determine whether field is relevant in job.) (field MEMB job:relevantFields]) (RemoveDerivationsOf [LAMBDA (field job) (* ref: " 9-JUN-82 10:51") (* Remove all derivations from job that have field as their result field. Return the new list of derivations.) job:derivations←(for d in job:derivations unless d:resultField=field collect d]) (RemoveValue [LAMBDA (field job) (* edited: " 4-FEB-83 13:26") (* Remove the current value of field from job. Also, remove any values derived using the removed value. Return the removed value.) (PROG ((value (JobFieldValue field job))) (if value then (SetJobField job field) (RemoveDerivationsOf field job) (for d in (for d1 in job:derivations when field MEMB d1:givens collect d1) do (RemoveValue d:resultField job))) (RETURN value]) (ResolveNewJobValue [LAMBDA (job field value) (* ref: "26-JUL-83 16:57") (* A new value has been assigned to a field of a copy job via the job description panel. Make values of all fields that were relevant before assignment of the new value be assertions, and remove any underived values of irrelevant fields. Check on enabled plan generators and attempt to derive values for the fields relevant to that check and for those fields that are parameters to any enabled generators. Assign those fields as relevant and any that supported the attempted derivations. If all the relevant fields have values, and no generator is enabled, then apply any applicable help units. Before returning, assign previous values or default values to unvalued fields that became relevant after the assignment of the new value. Return a list of the currently enabled generators.) (PROG (dList consistent? gens unprocessedFields (newValue? T) relevantFields) (for f in CopyJobFields do (if (RelevantField? f job) then (AddAssertion job f (JobFieldValue f job)) elseif ~(DerivedResult? f job) then (if (JobFieldValue f job) then (LISTPUT job:removedAssertions f (JobFieldValue f job))) (RemoveValue f job))) (AddAssertion job field value) (gens←(DeriveValuesForGenerators job)) (for gen in gens:1 do (\TraceIt BluebonnetTrace "Procedure " gen:planGeneratorName " enabled.")) (job:relevantFields←gens::1) (CLEARW CommentWindow) (generator←(job:planGenerator←(SelectPlanGenerator gens:1))) (if generator then (ShowTimeEstimate generator job) (if generator:advisor then (APPLY* generator:advisor job)) elseif (for f in gens::1 always (JobFieldValue f job)) then (ApplyHelpUnits job)) (RETURN job:planGenerator]) (SecondsToRoundedMinutes [LAMBDA (seconds) (* edited: " 1-FEB-83 15:29") (* Convert seconds to minutes and round off the result.) (FIX seconds/60.0+.5]) (SelectItem [LAMBDA (item window) (* ref: "26-MAY-82 15:58") (* selects an item in window) (if item and item:jobPanelField:selectedItem~=item then (FlipItem item window) item:jobPanelField:selectedItem←item]) (SelectPlanGenerator [LAMBDA (generators) (* edited: " 1-FEB-83 13:18") (* Select a generator from generators and return it. If there is an obviously faster one, then select it. Otherwise, ask the user.) (* Dummy definition for now.) generators:1]) (SetJobField [LAMBDA (job field value) (* edited: " 4-FEB-83 13:26") (* Set the value of field in copy job) (RECORDACCESS field job CopyJobRecord (QUOTE replace) value]) (ShowTimeEstimate [LAMBDA (generator job) (* ref: "26-JUL-83 15:26") (* Print a time estimate for the plan to be produced by the generator in the comment window.) (PROG (hours time) (job:timeEstimate←(GeneratorsTimeEstimate generator job)) [if job:timeEstimate then time←(MAX 1 (SecondsToRoundedMinutes job:timeEstimate)) (PrintComment (BQUOTE (The currently described job will take about ,@[COND ((ILESSP time 60) (LIST time)) (T (BQUOTE (, (SETQ hours (IQUOTIENT time 60)) , (COND ((EQ hours 1) (QUOTE hour)) (T (QUOTE hours))) and , (IREMAINDER time 60] , (COND ((EQ time 1) (QUOTE minute.)) ((IGREATERP time 60) (QUOTE minutes!)) (T (QUOTE minutes.] (printout CommentWindow T T]) (Subset? [LAMBDA (x y) (* edited: "19-JAN-83 15:59") (* Test whether list x is a subset of list y.) (for xi in x always xi MEMB y]) (SupportsForDerivation [LAMBDA (field job) (* edited: " 4-FEB-83 13:27") (* Return the list of fields that supports the value of field in job. Return NIL if the field has no value. The field supports itself if it is an assertion.) (if (JobFieldValue field job) then (for d in job:derivations when d:resultField=field join (for g in d:givens join (SupportsForDerivation g job))) or <field>]) (TimeEstimateForJob [LAMBDA (job) (* ref: "26-JUL-83 15:43") (* Return a time estimate for the job. Do so by determining an enabled generator for the job and calling its time estimating function. If no generators are enabled, return NIL.) (PROG (bestTime time (gens (DeriveValuesForGenerators job))) (for gen in gens:1 when time←(GeneratorsTimeEstimate gen job) do (if ~bestTime or time lt bestTime then bestTime←time)) (RETURN bestTime]) (TimeFor1To1 [LAMBDA (job) (* edited: " 6-FEB-83 11:38") (* Time estimator for Plan1To1.) (TimeForPlanners [BQUOTE (MakeReady SetPanel LoadRDH MakeCopies UnloadRdh UnloadOutputTray SayThankUser ,@ (COND ((EQ (fetch CopiesOnStandardPaper of job) (QUOTE No)) (QUOTE (LoadTopPaperTray UnloadTopPaperTray SelectBottomTray] job]) (TimeFor1To2 [LAMBDA (job) (* edited: " 4-FEB-83 16:01") (* Time estimator for Plan1To2.) (TimeForPlanners [BQUOTE (MakeReady SetPanel ReverseOriginals LoadRDH MakeCopies ReverseOriginals TransferToTopTray MakeCopies UnloadOutputTray SayThankYou ,@ (COND ((EQ (fetch CopiesOnStandardPaper of job) (QUOTE No)) (QUOTE (LoadTopPaperTray UnloadTopPaperTray SelectBottomTray] job]) (TimeFor2To1WithMaster [LAMBDA NIL (* edited: "11-MAR-83 13:50") 0]) (TimeForBdaNoMaster [LAMBDA (job) (* edited: " 6-FEB-83 12:21") (* Time estimator for PlanBdaNoMaster.) (PROG1 5 (* Pull BDA latch and raise the RDH.))+( TIMES job:#OfOriginalSheets (PROG1 3 (* Place original on glass and close cover.) )+(PROG1 1 (* Press Start.))+(PROG1 13 (* Copier overhead.))+(PROG1 (TIMES job:NumberOfCopies .8) (* Making the copies.) )+(PROG1 2 (* Open cover and remove original.)))+( PROG1 5 (* Close the RDH.))+(PROG1 2 (* Unload the output tray.))+( TimeForPlanners [BQUOTE (MakeReady SetPanel SayThankYou ,@ (COND ((EQ (fetch CopiesOnStandardPaper of job) (QUOTE No)) (QUOTE (LoadTopPaperTray UnloadTopPaperTray SelectBottomTray] job]) (TimeForBdaWithMaster [LAMBDA (job) (* ref: "26-JUL-83 15:49") (* Time estimator for PlanBdaWithMaster.) (PROG (subJob1 subJob2Time (subJob2 (CopyCopyJob job))) (subJob2:CopyBrightness←(QUOTE normal)) (subJob2:InputProcessor←(QUOTE RDH)) (subJob2:NumberOfCopies←(if job:CopiesOnStandardPaper=(QUOTE Yes) and job:Staple=(QUOTE No) and job:TwoSidedCopies=(QUOTE No) then job:NumberOfCopies-1 else job:NumberOfCopies)) (subJob2:OriginalsBound←(QUOTE No)) (subJob2:OriginalsOnStandardPaper←(QUOTE Yes)) (subJob2:OriginalsStandardSize←(QUOTE Yes)) (subJob2:CopyJob.Reduction←(QUOTE FullSize)) (subJob2:TwoSidedOriginals←(QUOTE No)) (subJob2Time←(TimeEstimateForJob subJob2)) (RETURN (if subJob2Time then subJob1←(CopyCopyJob job) subJob1:CopiesOnStandardPaper←(QUOTE Yes) subJob1:NumberOfCopies←1 subJob1:TwoSidedCopies←(QUOTE No) subJob1:Staple←(QUOTE No) (PROG1 5 (* Connect step.))+(TimeForBdaNoMaster subJob1)+subJob2Time+(-(TimeForPlanners (QUOTE (SayThankYou]) (TimeForPlanners [LAMBDA (planners job) (* edited: " 1-FEB-83 16:24") (* Determine a time estimate for doing all the steps produced by planners on job. Planners is a list of atoms that have timeEstimate properties. If the property is NIL, assume 0.0 If the property is an integer, assume that many seconds. If the property is an atom, call that function with the job as an argument.) (for p in planners bind time sum (time←(GETPROP p (QUOTE timeEstimate))) (if time then (if (FIXP time) then time else (APPLY* time job)) else 0]) (TimeForTooThick [LAMBDA (job) (* ref: "26-JUL-83 15:54") (* Time estimator for PlanTooThick.) (PROG (sheetsPerSubjob #OfSubjobs timePerSubjob (totalSheets (job:#OfOriginalSheets/(if job:TwoSidedOriginals=(QUOTE Yes) then 2 else 1))) (subjob (CopyCopyJob job))) (#OfSubjobs←(totalSheets+49)/50) (sheetsPerSubjob←totalSheets/#OfSubjobs) (subjob:#OfOriginalSheets←totalSheets/#OfSubjobs) (subjob:OriginalTooThick←(QUOTE No)) (timePerSubjob←(TimeEstimateForJob subjob)) (RETURN (if timePerSubjob then (PROG1 #OfSubjobs (* Divide originals into #OfSubjobs sections.) )+(PROG1 #OfSubjobs*timePerSubjob (* Do the subjobs.))+(PROG1 (if job:Collate then #OfSubjobs*job:NumberOfCopies else 0]) (TimeToCollate [LAMBDA (job) (* edited: "16-MAR-83 11:55") (* Estimate the time need to collate the copies for this job by hand.) (if job:Collate=(QUOTE Yes) then (if ~(job:#OfCopySheets) then (DeriveValue (QUOTE #OfCopySheets) job)) job:NumberOfCopies*(job:#OfCopySheets or 2) else 0]) (TimeToReverseOriginals [LAMBDA (job) (* edited: " 4-FEB-83 16:03") (* The time estimating function to reverse a set of originals.) job:#OfOriginalSheets/(if job:TwoSidedOriginals=(QUOTE Yes) then 2 else 1]) (TimeToStaple [LAMBDA (job) (* edited: "16-MAR-83 11:54") (* Time estimator for stapling the copies made in this job.) (if job:Staple=(QUOTE Yes) then 5+job:NumberOfCopies*3 else 0]) (UpdateJobField [LAMBDA (job field value) (* edited: "19-JAN-83 17:07") (* Put the new values into the copy job and make the implied changes to the job description panel.) (ResolveNewJobValue job field value) (UpdateJobDescriptionPanel job:descriptionPanel]) (UpdateJobDescriptionPanel [LAMBDA (window refreshFlg) (* edited: " 1-FEB-83 15:17") (* Redisplay relevant queries and erase all irrelevant queries. If refreshFlg is NIL, then redisplay only previously invisible relevant queries.) (for f in CopyJobFields bind [(job ←(WINDOWPROP window (QUOTE CopyJob] do (if (RelevantField? f job) then (if refreshFlg then (EraseJobPanelField (WINDOWPROP window f) window)) (RedisplayJobPanelField (WINDOWPROP window f) window) else (EraseJobPanelField (WINDOWPROP window f) window)) finally (if refreshFlg then (RedisplayMenuTitle (WINDOWPROP window (QUOTE #OfOriginalSheetsMenu)) job:#OfOriginalSheets Gacha12Bold) (RedisplayMenuTitle (WINDOWPROP window (QUOTE NumberOfCopiesMenu)) job:NumberOfCopies Gacha12Bold]) (WhenNumberOfCopiesMenuSelected [LAMBDA (item menu) (* edited: "16-MAR-83 12:51") (* WhenSelectedFn for the numberOfCopies menu.) (WhenPadMenuSelected item menu (QUOTE NumberOfCopies) (QUOTE NumberOfCopiesTimer]) (WhenOriginalsMenuSelected [LAMBDA (item menu) (* edited: "16-MAR-83 13:06") (* WhenSelectedFn for the #OfOriginals menu.) (WhenPadMenuSelected item menu (QUOTE #OfOriginalSheets) (QUOTE NumberOfOriginalsTimer]) (WhenPadMenuSelected [LAMBDA (item menu field timerVar) (* edited: "16-MAR-83 12:56") (* WhenSelectedFn for a number pad menu for field.) (if item~= "" then (PROG [cursor (job (WINDOWPROP (WFROMMENU menu) (QUOTE CopyJob] (RedisplayMenuTitle menu (if item=(QUOTE Clear) then 0 elseif (GREATERP (ABS (CLOCK 0) -(EVAL timerVar))/1000.0 30) then item else menu:MENU.TITLE*10+item) Gacha12Bold) (if menu:MENU.TITLE=0 then (UpdateJobDescriptionPanel job:descriptionPanel) else cursor←(CURSOR WAITINGCURSOR) (UpdateJobField job field menu:MENU.TITLE) (CURSOR cursor)) (SET timerVar (CLOCK 0]) ) (DECLARE: EVAL@COMPILE (LOADCOMP? 'LOADBLUEBONNET) ) (DECLARE: DONTCOPY (FILEMAP (NIL (3013 52018 (AddAssertion 3023 . 3611) (AddDerivation 3613 . 4374) (Advise1To2 4376 . 4652) (Advise2To1WithMaster 4654 . 4784) (AdviseBdaWithMaster 4786 . 6695) (ApplyHelpUnits 6697 . 7183 ) (CommentOnJob 7185 . 7607) (CopyCopyJob 7609 . 8107) (CopyingTime 8109 . 8391) (CreateFieldItems 8393 . 9608) (DefineDefaultJob 9610 . 10517) (DeriveValue 10519 . 12858) (DeriveValuesForGenerators 12860 . 15762) (DerivedResult? 15764 . 16145) (DeselectItem 16147 . 16495) (EraseJobPanelField 16497 . 16935) (FindEnabledGenerators 16937 . 17617) (FlashQuery 17619 . 18082) (FlipItem 18084 . 18370) ( FlipRegion 18372 . 18662) (GeneratorsTimeEstimate 18664 . 19029) (GetGeneratorParameters 19031 . 19329 ) (GiveUserQueryHelp 19331 . 19786) (HelpFromPanel 19788 . 20195) (InItem? 20197 . 20500) ( InitiateDescriptionPanel 20502 . 25242) (JobFieldValue 25244 . 26448) (JobPanelButtonHandler 26450 . 27994) (JobPanelHelpHandler 27996 . 29243) (PrintAndBox 29245 . 30106) (PrintComment 30108 . 30598) ( ProceedFromPanel 30600 . 32314) (RedisplayJobPanelField 32316 . 33631) (RedisplayMenu 33633 . 34102) ( RedisplayMenuTitle 34104 . 34606) (RefreshPanel 34608 . 34931) (RelevantField? 34933 . 35201) ( RemoveDerivationsOf 35203 . 35613) (RemoveValue 35615 . 36300) (ResolveNewJobValue 36302 . 38416) ( SecondsToRoundedMinutes 38418 . 38690) (SelectItem 38692 . 39039) (SelectPlanGenerator 39041 . 39503) (SetJobField 39505 . 39790) (ShowTimeEstimate 39792 . 40808) (Subset? 40810 . 41081) ( SupportsForDerivation 41083 . 41628) (TimeEstimateForJob 41630 . 42224) (TimeFor1To1 42226 . 42741) ( TimeFor1To2 42743 . 43315) (TimeFor2To1WithMaster 43317 . 43446) (TimeForBdaNoMaster 43448 . 44666) ( TimeForBdaWithMaster 44668 . 46011) (TimeForPlanners 46013 . 46700) (TimeForTooThick 46702 . 47811) ( TimeToCollate 47813 . 48286) (TimeToReverseOriginals 48288 . 48664) (TimeToStaple 48666 . 49008) ( UpdateJobField 49010 . 49409) (UpdateJobDescriptionPanel 49411 . 50466) ( WhenNumberOfCopiesMenuSelected 50468 . 50806) (WhenOriginalsMenuSelected 50808 . 51145) ( WhenPadMenuSelected 51147 . 52016))))) STOP