'From Squeak3.1alpha of 28 February 2001 [latest update: #4261] on 19 August 2001 at 4:38:34 pm'! "Change Set: AltLookFixes-ar Date: 19 August 2001 Author: Andreas Raab Fixes various little things with the alternative look: - Fix optional buttons to appear in 3Dish looks and fitting the size of the pane (and also get rid of all those #transparentSpacersOfSize: which are completely useless... ;-) - Fix the menu button to act on mouseDown - Fix PDAMorph to come up with okay colors. "! !CodeHolder methodsFor: 'controls' stamp: 'ar 8/19/2001 16:15'! addOptionalButtonsTo: window at: fractions plus: verticalOffset "If the receiver wishes it, add a button pane to the window, and answer the verticalOffset plus the height added" | delta buttons divider | self wantsOptionalButtons ifFalse: [^verticalOffset]. delta _ self defaultButtonPaneHeight. buttons _ self optionalButtonRow color: (Display depth <= 8 ifTrue: [Color transparent] ifFalse: [Color gray alpha: 0.2]); borderWidth: 0. Preferences alternativeWindowLook ifTrue:[ buttons color: Color transparent. buttons submorphsDo:[:m| m borderWidth: 2; borderColor: #raised]. ]. divider _ BorderedSubpaneDividerMorph forBottomEdge. Preferences alternativeWindowLook ifTrue:[ divider extent: 4@4; color: Color transparent; borderColor: #raised; borderWidth: 2. ]. window addMorph: buttons fullFrame: (LayoutFrame fractions: fractions offsets: (0@verticalOffset corner: 0@(verticalOffset + delta - 1))). window addMorph: divider fullFrame: (LayoutFrame fractions: fractions offsets: (0@(verticalOffset + delta - 1) corner: 0@(verticalOffset + delta))). ^ verticalOffset + delta! ! !CodeHolder methodsFor: 'controls' stamp: 'ar 8/19/2001 16:28'! codePaneProvenanceButton "Answer a button that reports on, and allow the user to modify, the code-pane-provenance setting" | aButton | aButton _ UpdatingSimpleButtonMorph newWithLabel: 'source'. aButton setNameTo: 'codeProvenance'. aButton useSquareCorners. aButton target: self; wordingSelector: #codePaneProvenanceString; actionSelector: #offerWhatToShowMenu. aButton setBalloonText: 'Governs what view is shown in the code pane. Click here to change the view'. aButton actWhen: #buttonDown. aButton beTransparent. aButton borderColor: Color black. ^aButton! ! !CodeHolder methodsFor: 'controls' stamp: 'ar 8/19/2001 16:13'! optionalButtonRow "Answer a row of control buttons" | aRow aButton aLabel | aRow _ AlignmentMorph newRow. aRow setNameTo: 'buttonPane'. aRow beSticky. aRow hResizing: #spaceFill. aRow wrapCentering: #center; cellPositioning: #leftCenter. aRow clipSubmorphs: true. aRow cellInset: 3. Preferences menuButtonInToolPane ifTrue: [aRow addMorphFront: self menuButton]. self optionalButtonPairs do: [:tuple | aButton _ PluggableButtonMorph on: self getState: nil action: tuple second. aButton useRoundedCorners; hResizing: #spaceFill; vResizing: #spaceFill; onColor: Color transparent offColor: Color transparent. aLabel _ Preferences abbreviatedBrowserButtons ifTrue: [self abbreviatedWordingFor: tuple second] ifFalse: [nil]. aButton label: (aLabel ifNil: [tuple first asString])" font: (StrikeFont familyName: 'Atlanta' size: 9)". tuple size > 2 ifTrue: [aButton setBalloonText: tuple third]. aRow addMorphBack: aButton]. aRow addMorphBack: self codePaneProvenanceButton. ^ aRow! ! !ChangeList methodsFor: 'menu actions' stamp: 'ar 8/19/2001 16:25'! optionalButtonRow "Answer a row of buttons to occur in a tool pane" | aRow aButton | aRow _ AlignmentMorph newRow. aRow hResizing: #spaceFill. aRow clipSubmorphs: true. aRow layoutInset: 5@2; cellInset: 3. aRow wrapCentering: #center; cellPositioning: #leftCenter. self changeListButtonSpecs do: [:triplet | aButton _ PluggableButtonMorph on: self getState: nil action: triplet second. aButton hResizing: #spaceFill; vResizing: #spaceFill; useRoundedCorners; label: triplet first asString; askBeforeChanging: true; onColor: Color transparent offColor: Color transparent. aRow addMorphBack: aButton. aButton setBalloonText: triplet third. ]. aRow addMorphBack: self diffButton. aRow addMorphBack: self prettyDiffButton. ^ aRow! ! !Debugger methodsFor: 'initialize' stamp: 'ar 8/19/2001 16:28'! optionalButtonRow "Answer a button pane affording the user one-touch access to certain functions; the pane is given the formal name 'buttonPane' by which it can be retrieved by code wishing to send messages to widgets residing on the pane" | aRow aButton | aRow _ AlignmentMorph newRow beSticky. aRow setNameTo: 'buttonPane'. aRow clipSubmorphs: true. aRow layoutInset: 5@2. aRow cellInset: 3. aButton _ SimpleButtonMorph new target: self. aButton color: Color lightRed; borderWidth: 1; borderColor: Color red darker. self optionalButtonPairs do: [:pair | aButton _ PluggableButtonMorph on: self getState: nil action: pair second. aButton hResizing: #spaceFill; vResizing: #spaceFill; useRoundedCorners; label: pair first asString; askBeforeChanging: true; onColor: Color transparent offColor: Color transparent. Preferences alternativeWindowLook ifTrue:[aButton borderWidth: 2; borderColor: #raised]. aRow addMorphBack: aButton]. ^ aRow! ! !FileList methodsFor: 'initialization' stamp: 'ar 8/19/2001 16:29'! optionalButtonRow | aRow aButton | aRow _ AlignmentMorph newRow beSticky. aRow color: Color transparent. aRow clipSubmorphs: true. aRow layoutInset: 5@1; cellInset: 6. self optionalButtonSpecs do: [:spec | aButton _ PluggableButtonMorph on: self getState: nil action: spec second. aButton color: Color transparent; hResizing: #spaceFill; vResizing: #spaceFill; useRoundedCorners; label: spec first asString; askBeforeChanging: true; onColor: Color transparent offColor: Color transparent. aRow addMorphBack: aButton. aButton setBalloonText: spec fourth. (spec second == #sortBySize) ifTrue: [aRow addTransparentSpacerOfSize: (4@0)]]. ^ aRow! ! !FileList class methodsFor: 'instance creation' stamp: 'ar 8/19/2001 16:22'! openAsMorph "Open a morphic view of a FileList on the default directory." | dir aFileList window fileListTop buttons | dir _ FileDirectory default. aFileList _ self new directory: dir. window _ (SystemWindow labelled: dir pathName) model: aFileList. window addMorph: ((PluggableListMorph on: aFileList list: #volumeList selected: #volumeListIndex changeSelected: #volumeListIndex: menu: #volumeMenu:) autoDeselect: false) frame: (0@0 corner: 0.3@0.2). window addMorph: (PluggableTextMorph on: aFileList text: #pattern accept: #pattern:) frame: (0@0.2 corner: 0.3@0.3). aFileList wantsOptionalButtons ifTrue:[ buttons _ aFileList optionalButtonRow. Preferences alternativeWindowLook ifTrue:[ buttons color: Color transparent. buttons submorphsDo:[:m| m borderWidth: 2; borderColor: #raised]. ]. window addMorph: buttons frame: (0.3 @ 0 corner: 1 @ 0.08).. fileListTop _ 0.08] ifFalse: [fileListTop _ 0]. window addMorph: (PluggableListMorph on: aFileList list: #fileList selected: #fileListIndex changeSelected: #fileListIndex: menu: #fileListMenu:) frame: (0.3 @ fileListTop corner: 1@0.3). window addMorph: (PluggableTextMorph on: aFileList text: #contents accept: #put: readSelection: #contentsSelection menu: #fileContentsMenu:shifted:) frame: (0@0.3 corner: 1@1). ^ window! ! !PDA methodsFor: 'initialization' stamp: 'ar 8/19/2001 16:35'! openAsMorphIn: window "PDA new openAsMorph openInWorld" "Create a pluggable version of all the morphs for a Browser in Morphic" | dragNDropFlag paneColor chooser | window color: Color black. paneColor _ (Color r: 0.6 g: 1.0 b: 0.0). window model: self. Preferences alternativeWindowLook ifTrue:[ window color: Color white. window paneColor: paneColor]. dragNDropFlag _ Preferences browseWithDragNDrop. window addMorph: ((PluggableListMorph on: self list: #peopleListItems selected: #peopleListIndex changeSelected: #peopleListIndex: menu: #peopleMenu: keystroke: #peopleListKey:from:) enableDragNDrop: dragNDropFlag) frame: (0@0 corner: 0.3@0.25). window addMorph: ((chooser _ PDAChoiceMorph new color: paneColor) contentsClipped: 'all'; target: self; actionSelector: #chooseFrom:categoryItem:; arguments: {chooser}; getItemsSelector: #categoryChoices) frame: (0@0.25 corner: 0.3@0.3). window addMorph: ((MonthMorph newWithModel: self) color: paneColor; extent: 148@109) frame: (0.3@0 corner: 0.7@0.3). window addMorph: (PDAClockMorph new color: paneColor; faceColor: (Color r: 0.4 g: 0.8 b: 0.6)) "To match monthMorph" frame: (0.7@0 corner: 1.0@0.3). window addMorph: ((PluggableListMorph on: self list: #toDoListItems selected: #toDoListIndex changeSelected: #toDoListIndex: menu: #toDoMenu: keystroke: #toDoListKey:from:) enableDragNDrop: dragNDropFlag) frame: (0@0.3 corner: 0.3@0.7). window addMorph: ((PluggableListMorph on: self list: #scheduleListItems selected: #scheduleListIndex changeSelected: #scheduleListIndex: menu: #scheduleMenu: keystroke: #scheduleListKey:from:) enableDragNDrop: dragNDropFlag) frame: (0.3@0.3 corner: 0.7@0.7). window addMorph: ((PluggableListMorph on: self list: #notesListItems selected: #notesListIndex changeSelected: #notesListIndex: menu: #notesMenu: keystroke: #notesListKey:from:) enableDragNDrop: dragNDropFlag) frame: (0.7@0.3 corner: 1@0.7). window addMorph: (PluggableTextMorph on: self text: #currentItemText accept: #acceptCurrentItemText: readSelection: #currentItemSelection menu: #currentItemMenu:) frame: (0@0.7 corner: 1@1). Preferences alternativeWindowLook ifFalse:[ window firstSubmorph color: paneColor. ]. window updatePaneColors. window step. ^ window! ! !SystemWindow methodsFor: 'initialization' stamp: 'ar 8/19/2001 16:30'! addMenuControl "If I have a label area, add a menu control to it. " | frame | labelArea ifNil: [^ self]. "No menu if no label area" menuBox ifNotNil: [menuBox delete]. menuBox _ IconicButton new borderWidth: 0; labelGraphic: (ScriptingSystem formAtKey: 'TinyMenu'); color: Color transparent; actWhen: #buttonDown; actionSelector: #offerWindowMenu; target: self; setBalloonText: 'window menu'. frame _ LayoutFrame new. frame leftFraction: 0; leftOffset: 17; topFraction: 0; topOffset: 0. menuBox layoutFrame: frame. labelArea addMorph: menuBox! !