'From Squeak3.1alpha of 5 February 2001 [latest update: #3547] on 8 February 2001 at 2:54:25 pm'! "Change Set: squeakFlapEtc-sw Date: 8 February 2001 Author: Scott Wallace Some improvements primarily centered around the Squeak flap. (1) The three space- and cpu-consuming status lines are removed; in their place is an 'about this system...' item, clicking of which will bring up the status information. (2) The action of the Annotations button now places the annotations window automatically rather than placing it in the hand. (3) The 'about flaps...' button is removed from the Squeak flap (it's still available in the 'windows and flaps' menu.) (4) The information obtained when requesting 'about flaps' has been brought up to date. (5) The window-colors panel now opens in the center of the world rather than being attached to the hand at launch. (6) The 'annotations...' button is removed from the Squeak flap and relocated to the 'help' menu. Seemingly almost nobody ever read the information provided anyway so why bother putting it in such a conspicuous place? (7) Some variant wording between the mvc and morphic versions of the Help menu are harmonized."! !Preferences class methodsFor: 'parameters' stamp: 'sw 2/8/2001 14:11'! editAnnotations "Preferences editAnnotations" | aPanel ins outs current aMorph aWindow aButton info pair | Smalltalk isMorphic ifFalse: [^ self inform: 'Sorry, you must be in a morphic project to use this feature.']. aPanel _ AlignmentMorph newRow extent: 300 @ 100. ins _ AlignmentMorph newColumn extent: 150 @ 100. ins enableDrop: true; beSticky. ins color: Color green muchLighter. outs _ ins fullCopy. outs color: Color red muchLighter. aPanel addMorph: outs; addMorphFront: ins. outs position: (ins position + (200 @ 0)). current _ self defaultAnnotationRequests. info _ self annotationInfo. current do: [:sym | pair _ info detect: [:aPair | aPair first == sym]. aMorph _ StringMorph new contents: pair first. aMorph setBalloonText: pair last. aMorph enableDrag: true. aMorph on: #startDrag send: #startDrag:with: to: aMorph. ins addMorphBack: aMorph]. info do: [:aPair | (current includes: aPair first) ifFalse: [aMorph _ StringMorph new contents: aPair first. aMorph setBalloonText: aPair last. aMorph enableDrag: true. aMorph on: #startDrag send: #startDrag:with: to: aMorph. outs addMorph: aMorph]]. aPanel layoutChanged. aWindow _ SystemWindowWithButton new setLabel: 'Annotations'. aButton _ SimpleButtonMorph new target: Preferences; actionSelector: #acceptAnnotationsFrom:; arguments: (Array with: aWindow); label: 'apply'; borderWidth: 0; borderColor: Color transparent; color: Color transparent. aButton submorphs first color: Color blue. aButton setBalloonText: 'After moving all the annotations you want to the left (green) side, and all the ones you do NOT want to the right (pink) side, hit this "apply" button to have your choices take effect.'. aWindow buttonInTitle: aButton; adjustExtraButton. self currentWorld addMorphCentered: (aPanel wrappedInWindow: aWindow). aWindow activateAndForceLabelToShow! ! !Preferences class methodsFor: 'window colors' stamp: 'sw 2/8/2001 14:36'! windowSpecificationPanel "Preferences windowSpecificationPanel" | aPanel buttonRow aButton aRow aSwatch aColor aWindow aMiniWorld | aPanel _ AlignmentMorph newColumn hResizing: #shrinkWrap; vResizing: #shrinkWrap; layoutInset: 0. aPanel addMorph: (buttonRow _ AlignmentMorph newRow color: (aColor _ Color tan lighter)). aButton _ SimpleButtonMorph new target: self. buttonRow addTransparentSpacerOfSize: 2@0. buttonRow addMorphBack: (SimpleButtonMorph new label: '?'; target: self; actionSelector: #windowColorHelp; setBalloonText: 'Click for an explanation of this panel'; color: Color veryVeryLightGray; yourself). buttonRow addTransparentSpacerOfSize: 8@0. #( ('Bright' installBrightWindowColors yellow 'Use standard bright colors for all windows.') ('Pastel' installPastelWindowColors paleMagenta 'Use standard pastel colors for all windows.') ('White' installUniformWindowColors white 'Use white backgrounds for all standard windows.')) do: [:quad | aButton _ aButton fullCopy label: quad first; actionSelector: quad second; color: (Color colorFrom: quad third); setBalloonText: quad fourth; yourself. buttonRow addMorphBack: aButton. buttonRow addTransparentSpacerOfSize: 10@0]. self windowColorClasses do: [:aClassName | aRow _ AlignmentMorph newRow color: aColor. aSwatch _ ColorSwatch new target: self; getSelector: #windowColorFor:; putSelector: #setWindowColorFor:to:; argument: aClassName; extent: (40 @ 20); yourself. aRow addMorphFront: aSwatch. aRow addTransparentSpacerOfSize: (12 @ 1). aRow addMorphBack: (StringMorph contents: aClassName font: TextStyle defaultFont). aPanel addMorphBack: aRow]. Smalltalk isMorphic ifTrue: [buttonRow _ buttonRow fullCopy removeAllMorphs. buttonRow addTransparentSpacerOfSize: 25@0. aButton _ aButton fullCopy color: Color tan muchLighter. aButton label: 'Update Tools Flap'; target: Utilities; actionSelector: #replaceToolsFlap. buttonRow addMorphBack: aButton. aButton setBalloonText: 'Press here to place tools which use the above window-color choices into the Tools flap.'. aPanel addMorphBack: buttonRow. aWindow _ aPanel wrappedInWindowWithTitle: 'Window Colors'. self currentWorld addMorphCentered: aWindow. aWindow activateAndForceLabelToShow ] ifFalse: [(aMiniWorld _ MVCWiWPasteUpMorph newWorldForProject: nil) addMorph: aPanel. aMiniWorld startSteppingSubmorphsOf: aPanel. MorphWorldView openOn: aMiniWorld label: 'Window Colors' extent: aMiniWorld fullBounds extent]! ! !ScreenController methodsFor: 'nested menus' stamp: 'sw 2/8/2001 14:44'! helpMenu "Answer the help menu to be put up as a screen submenu" ^ SelectionMenu labelList: #( 'keep this menu up' 'about this system...' 'update code from server' 'preferences...' 'command-key help' 'font size summary' 'useful expressions' 'view graphical imports' 'standard graphics library'), (Array with: (Preferences soundsEnabled ifFalse: ['turn sound on'] ifTrue: ['turn sound off'])) , #( 'definition for...' 'set author initials...' 'vm statistics' 'space left') lines: #(1 4 6 11) selections: #(durableHelpMenu aboutThisSystem absorbUpdatesFromServer editPreferences openCommandKeyHelp fontSizeSummary openStandardWorkspace viewImageImports standardGraphicsLibrary soundOnOrOff lookUpDefinition setAuthorInitials vmStatistics garbageCollect) " ScreenController new helpMenu startUp "! ! !TheWorldMenu methodsFor: 'construction' stamp: 'sw 2/8/2001 14:43'! helpMenu "Build the help menu for the world." | screenCtrl | screenCtrl _ ScreenController new. ^self fillIn: (self menu: 'help...') from: { {'about this system...'. {Smalltalk. #aboutThisSystem}. 'current version information.'}. {'update code from server'. {Utilities. #updateFromServer}. 'load latest code updates via the internet'}. {'preferences...'. {Preferences. #openPreferencesInspector}. 'view and change various options.'}. nil. {'command-key help'. { Utilities . #openCommandKeyHelp}. 'summary of keyboard shortcuts.'}. {'world menu help'. { self . #worldMenuHelp}. 'helps find menu items buried in submenus.'}. "{'info about flaps' . { Utilities . #explainFlaps}. 'describes how to enable and use flaps.'}." {'font size summary' . { Utilities . #fontSizeSummary}. 'summary of names and sizes of available fonts.'}. {'useful expressions' . { Utilities . #openStandardWorkspace}. 'a window full of useful expressions.'}. {'annotation setup...' . { Preferences . #editAnnotations}. 'Click here to get a little window that will allow you to specify which types of annotations, in which order, you wish to see in the annotation panes of browsers and other tools'}. nil. {'graphical imports' . { Smalltalk . #viewImageImports}. 'view the global repository called ImageImports; you can easily import external graphics into ImageImports via the FileList'}. {'standard graphics library' . { ScriptingSystem . #inspectFormDictionary}. 'lets you view and change the system''s standard library of graphics.'}. nil. {'telemorphic...' . {self. #remoteDo}. 'commands for doing multi-machine "telemorphic" experiments'}. {#soundEnablingString . { Preferences . #toggleSoundEnabling}. 'turning sound off will completely disable Squeak''s use of sound.'}. {'definition for...' . { Utilities . #lookUpDefinition}. 'if connected to the internet, use this to look up the definition of an English word.'}. nil. {'set author initials...' . { screenCtrl . #setAuthorInitials }. 'supply initials to be used to identify the author of code and other content.'}. {'vm statistics' . { screenCtrl . #vmStatistics}. 'obtain some intriguing data about the vm.'}. {'space left' . { screenCtrl . #garbageCollect}. 'perform a full garbage-collection and report how many bytes of space remain in the image.'}. } ! ! !Utilities class methodsFor: 'flaps' stamp: 'sw 2/8/2001 14:33'! addSystemStatusLinesTo: aPlayfield "Add system status info. In this version, we just add a button which can be called to deliver up status information on demand" | aButton | aButton _ SimpleButtonMorph new target: Smalltalk; actionSelector: #aboutThisSystem; label: 'about this system'. aButton color: Color cyan muchLighter. aButton setBalloonText: 'click here to find out version information'. aPlayfield addCenteredAtBottom: aButton offset: 16.! ! !Utilities class methodsFor: 'flaps' stamp: 'sw 2/8/2001 14:31'! explainFlaps "Flaps are like drawers on the edge of the screen, which can be opened so that you can use what is inside them, and closed when you do not need them. They have many possible uses, a few of which are illustrated by the default set of flaps you can get as described below. 'Global flaps' are available in every morphic project. As you move from project to project, you will see the same flaps in each. To get started using global flaps, set the 'useGlobalFlaps' Preference to true, or choose 'start using global flaps' from the windows/flaps menu. You can fine-tine which global flaps show in which project by using the 'which global flaps...' menu item found in the 'windows & flaps' menu. 'Project flaps' are flaps that belong to a single morphic project. If a flap is set up as a parts bin (such as the default Tools and Supplies flaps), you can use it to create new objects -- just open the flap, then find the object you want, and drag it out; when the cursor leaves the flap, the flap itself will snap closed, and you''ll be left holding the new object -- just click to place it exactly where you want it. If a flap is *not* set up as a parts bin (such as the default 'Squeak' flap at the left edge of the screen) you can park objects there (this is an easy way to move objects from project to project) and you can place your own private controls there, etc. Everything in the default 'Squeak' flap (and all the other default flaps, for that matter) is there only for illustrative purposes -- every user will want to fine-tune the flaps to suit his/her own style and needs. Each flap may be set up to appear on mouseover, dragover, both, or neither. See the menu items described below for more about these and other options. You can open a closed flap by clicking on its tab, or by dragging the tab toward the center of the screen You can close an open flap by clicking on its tab or by dragging the tab back off the edge of the screen. Drag the tab of a flap to reposition the tab and to resize the flap itself. Repositioning starts when you drag the cursor out of the original tab area. If flaps or their tabs seem wrongly positioned or lost, try issuing a restoreDisplay from the screen menu. The red-halo menu on a flap allows you to change the flap's properties. For greatest ease of use, request 'keep this menu up' here -- that way, you can easily explore all the options in the menu. tab color... Lets you change the color of the flap's tab. flap color... Lets you change the color of the flap itself. use textual tab... If the tab is not textual, makes it become textual. change tab wording... If the tab is already textual, allows you to edit its wording. use graphical tab... If the tab is not graphical, makes it become graphical. choose tab graphic... If the tab is already graphical, allows you to change the picture. use solid tab... If the tab is not solid, makes it become solid, i.e. appear as a solid band of color along the entire length or width of the screen. parts-bin behavior If set, then dragging an object from the flap tears off a new copy of the object. dragover If set, the flap opens on dragover and closes again on drag-leave. mouseover If set, the flap opens on mouseover and closes again on mouse-leave. cling to edge... Governs which edge (left, right, top, bottom) the flap adheres to. global If set, the same flap will be available in all projects; if not, the flap will will occur only in one project. destroy this flap Deletes the flap. To define a new flap, use 'new global flap...' or 'new project flap...', found in the 'windows and flaps' menu. To reinstate the default system flaps, evaluate 'Utilities reinstateDefaultFlaps' (caveat -- this will first remove all existing flaps, including any that you may have manually added or edited.) If flaps that you wish to use appear to be buried behind other objects on your screen, simply clicking on the desktop background will bring all flap tabs to the front. To add, delete, or edit things on a given flap, it is often wise first to suspend the flap''s mouse-over and drag-over sensitivity, so it won''t keep disappearing on you while you''re trying to work with it. Besides the three standard flaps delivered with the default system, there are two other flaps readily available on demand from the 'windows & flaps' menu -- one is called 'Stack Tools', which provides some tools useful for building stack-like content, the other is called 'Menus', which provides a montage of many of the system menus" "Open a window giving flap help." (StringHolder new contents: (self class firstCommentAt: #explainFlaps)) openLabel: 'Flaps in Morphic' "Utilities explainFlaps" ! ! !Utilities class methodsFor: 'flaps' stamp: 'sw 2/8/2001 14:44'! standardLeftFlap | aFlap aFlapTab aButton aClock buttonColor anOffset | aFlap _ PasteUpMorph newSticky borderWidth: 0. aFlapTab _ FlapTab new referent: aFlap. aFlapTab assumeString: 'Squeak' font: Preferences standardFlapFont orientation: #vertical color: Color brown lighter lighter. aFlapTab edgeToAdhereTo: #left; inboard: false. aFlapTab setToPopOutOnDragOver: true. aFlapTab setToPopOutOnMouseOver: true. aFlapTab position: (0 @ ((Display height - aFlapTab height) // 2)). aFlap beFlap: true. aFlap color: (Color brown muchLighter lighter "alpha: 0.3"). aFlap extent: 200 @ self currentWorld height. self addProjectNavigationButtonsTo: aFlap. anOffset _ 16. buttonColor _ Color green muchLighter. aButton _ SimpleButtonMorph new target: Smalltalk. aButton color: buttonColor. aButton actionSelector: #saveSession. aButton setBalloonText: 'Make a complete snapshot of the current state of the image onto disk.'. aButton label: 'snapshot'. aFlap addCenteredAtBottom: aButton offset: anOffset. aButton _ aButton fullCopy target: Utilities. aButton actionSelector: #fileOutChanges. aButton label: 'file out changes'. aButton setBalloonText: 'File out the current change set to disk.'. aFlap addMorph: aButton. aFlap addCenteredAtBottom: aButton offset: anOffset. aButton _ aButton fullCopy target: Utilities. aButton actionSelector: #browseRecentSubmissions. aButton setBalloonText: 'Open a message-list browser showing the 20 most-recently-submitted methods.'. aButton label: 'recent submissions'. aFlap addCenteredAtBottom: aButton offset: anOffset. aClock _ ClockMorph newSticky. aClock color: Color red. aClock showSeconds: false. aClock font: (TextStyle default fontAt: 3). aClock step. aClock setBalloonText: 'The time of day. If you prefer to see seconds, check out my menu.'. aFlap addCenteredAtBottom: aClock offset: anOffset. aButton _ aButton fullCopy target: Preferences. aButton actionSelector: #openPreferencesInspector. aButton setBalloonText: 'Open a window allowing me to view and change various Preferences.'. aButton label: 'preferences...'. aButton color: Color cyan muchLighter. aFlap addCenteredAtBottom: aButton offset: anOffset. aButton _ aButton fullCopy target: Utilities. aButton actionSelector: #updateFromServer. aButton label: 'load code updates'. aButton setBalloonText: 'Check the Squeak server for any new code updates, and load any that are found.'. aFlap addCenteredAtBottom: aButton offset: anOffset. self addSystemStatusLinesTo: aFlap. aButton _ TrashCanMorph newSticky. aFlap addCenteredAtBottom: aButton offset: anOffset. aButton startStepping. ^ aFlapTab! ! "Postscript:" Preferences okToReinitializeFlaps ifTrue: [Utilities reinstateDefaultFlaps]. !