(FILECREATED " 7-Jul-85 23:45:40" {PHYLUM}<NOTECARDS>RELEASE1.2I>STYLESHEETPATCH.;2 6065 changes to: (FNS STYLESHEET.CLEANUP) (VARS STYLESHEETPATCHCOMS) previous date: " 7-Jul-85 21:36:08" {PHYLUM}<NOTECARDS>RELEASE1.2I>STYLESHEETPATCH.;1) (* Copyright (c) 1985 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT STYLESHEETPATCHCOMS) (RPAQQ STYLESHEETPATCHCOMS ((* * A patch to STYLESHEET to allow any WHENSELECTEDFNs on the menus to be called. Unless the old WHENSELECTEDFN returns ABORT, the given selection will be made as usual.) (FNS STYLESHEET STYLESHEET.SETUP STYLESHEET.CLEANUP STYLESHEET.WHENSELECTEDFN))) (* * A patch to STYLESHEET to allow any WHENSELECTEDFNs on the menus to be called. Unless the old WHENSELECTEDFN returns ABORT, the given selection will be made as usual.) (DEFINEQ (STYLESHEET (LAMBDA (STYLE) (* rht: " 7-Jul-85 21:20") (* * Creates a window, lays out the menus in it, and waits for BACKGROUND to notify it that the the user has made all his selections and hit the DONE button. Then removes the window and returns the selections the user made.) (* * rht 7/7/85: No longer holds old WHENSELECTEDFNs. They're cached on a MENUPROP.) (OR (STYLESHEETP STYLE) (\ILLEGAL.ARG STYLE)) (STYLESHEET.SETUP STYLE) (LET ((W (STYLESHEET.CREATE.WINDOW STYLE) (* Lay out stylesheet of appropriate size and fill it in.) )) (* * Wait until the user has filled everything in he needs to, and has hit the DONE button.) (STYLESHEET.WAIT.TILL.DONE W STYLE) (* * Clean things up and return user's selections.) (PROG1 (if (EQ (WINDOWPROP W (QUOTE HOW) NIL) (QUOTE ABORT)) then (* user selected ABORT) NIL else (STYLESHEET.GET.SELECTIONS STYLE)) (STYLESHEET.CLEANUP W STYLE))))) (STYLESHEET.SETUP (LAMBDA (STYLESHEET) (* rht: " 7-Jul-85 21:17") (* * Changes the WHENSELECTEDFNs of all the menus to be the appropriate one for stylesheet menus, and returns the old WHENSELECTEDFNs. Also NILLs the SHADEDITEMS of each menu, since STYLESHEET.SHADE.SELECTIONS depends on the validity of this field. (ADDMENU should really do it -- submit AR.)) (* * rht 7/7/85: No longer returns list of old WHENSELECTEDFNs. Now caches them on menuprop. This is slightly space-problematic since we can't ever completely remove a MENUPROP from a menu. There should be a REMMENUPROP.) (for BLOCK in (STYLE.PROP STYLESHEET (QUOTE \STYLE.BLOCKS)) do (LET* ((MENU (fetch (STYLEBLOCK MENU) of BLOCK)) (WHENSELECTEDFN (fetch (MENU WHENSELECTEDFN) of MENU))) (AND WHENSELECTEDFN (PUTMENUPROP MENU (QUOTE OLD.WHENSELECTEDFN) WHENSELECTEDFN)) (replace (MENU WHENSELECTEDFN) of MENU with (FUNCTION STYLESHEET.WHENSELECTEDFN)) (replace (MENU SHADEDITEMS) of MENU with NIL))))) (STYLESHEET.CLEANUP (LAMBDA (W STYLESHEET) (* rht: " 7-Jul-85 21:50") (* * cleans up the WHENSELECTEDFNs in a stylesheet. And closes its window.) (* * rht 7/7/85: Now finds old WHENSELECTEDFNs on a menuprop of each menu.) (for I in (STYLE.PROP STYLESHEET (QUOTE ITEMS)) do (* * Restore the old WHENSELECTEDFNs and MENUUSERDATAs.) (LET ((OLD.WHENSELECTEDFN (GETMENUPROP I (QUOTE OLD.WHENSELECTEDFN)))) (replace WHENSELECTEDFN of I with OLD.WHENSELECTEDFN) (if OLD.WHENSELECTEDFN then (PUTMENUPROP I (QUOTE OLD.WHENSELECTEDFN) NIL)))) (* * Get rid of the stylesheet window) (CLOSEW W))) (STYLESHEET.WHENSELECTEDFN (LAMBDA (ELEMENT MENU BUTTON) (* rht: " 7-Jul-85 21:30") (* * Special whenselectedfn for menus inside stylesheets. Permanently shades the selected item and records the new selection.) (* * rht 7/7/85: Now calls old WHENSELECTEDFN if there is one. Bail out if it returns (QUOTE ABORT)) (LET ((BLOCK (CDR (FASSOC MENU (STYLE.PROP (WINDOWPROP (WFROMMENU MENU) (QUOTE STYLESHEET)) (QUOTE \MENU.TO.BLOCK))))) SELECTIONS (OLD.WHENSELECTEDFN (GETMENUPROP MENU (QUOTE OLD.WHENSELECTEDFN)))) (SETQ SELECTIONS (fetch (STYLEBLOCK SELECTIONS) of BLOCK)) (if (OR (NULL OLD.WHENSELECTEDFN) (NEQ (APPLY* OLD.WHENSELECTEDFN ELEMENT MENU BUTTON) (QUOTE ABORT))) then (* * Modify recorded selections.) (replace (STYLEBLOCK SELECTIONS) of BLOCK with (SELECTQ (fetch (STYLEBLOCK FILL) of BLOCK) (T (* * Can have 0 or 1 selection. If selected same one twice, undo the selection, else change selection.) (if (EQ ELEMENT SELECTIONS) then NIL else ELEMENT)) (MULTI (* * Can have any number of selection. If made same selection twice, remove it; else add it to the list of selections so far.) (if (FMEMB ELEMENT SELECTIONS) then (REMOVE ELEMENT SELECTIONS) else (CONS ELEMENT SELECTIONS))) (NIL (* * Must have exactly one selection. Change the current selection.) ELEMENT) (SHOULDNT))) (* * Display new selections.) (STYLESHEET.SHADE.SELECTIONS BLOCK))))) ) (PUTPROPS STYLESHEETPATCH COPYRIGHT ("Xerox Corporation" 1985)) (DECLARE: DONTCOPY (FILEMAP (NIL (875 5979 (STYLESHEET 885 . 2112) (STYLESHEET.SETUP 2114 . 3327) (STYLESHEET.CLEANUP 3329 . 4124) (STYLESHEET.WHENSELECTEDFN 4126 . 5977))))) STOP