'From Squeak3.7alpha of 11 September 2003 [latest update: #5816] on 4 April 2004 at 12:34:30 pm'! "Change Set: hScrollbarFixes2-sps Date: 4 April 2004 Author: Steven Swerling Fix for hScrollbar bug when used in MultiColumn lists. Fixed some cases where the hScrollbar is obscured when using flop-out scrollbars. Also, adds a preference called 'alwaysHideHScrollbar', which suppresses display of horizontal scrollbars (this option overrides the 'alwaysShowHorizontalScrollbar' pref). Tweaks the pane options accessors to allow overriding system preferences on individual scrollpanes" ! !Browser methodsFor: 'initialize-release' stamp: 'sps 4/3/2004 19:38'! openAsMorphClassEditing: editString "Create a pluggable version a Browser on just a single class." | window dragNDropFlag hSepFrac switchHeight mySingletonClassList | window _ (SystemWindow labelled: 'later') model: self. dragNDropFlag _ Preferences browseWithDragNDrop. hSepFrac _ 0.3. switchHeight _ 25. mySingletonClassList _ PluggableListMorph on: self list: #classListSingleton selected: #indexIsOne changeSelected: #indexIsOne: menu: #classListMenu:shifted: keystroke: #classListKey:from:. mySingletonClassList enableDragNDrop: dragNDropFlag. self addLowerPanesTo: window at: (0@hSepFrac corner: 1@1) with: editString. window addMorph: mySingletonClassList fullFrame: ( LayoutFrame fractions: (0@0 corner: 0.5@0) offsets: (0@0 corner: 0@switchHeight) ). self addMorphicSwitchesTo: window at: ( LayoutFrame fractions: (0.5@0 corner: 1.0@0) offsets: (0@0 corner: 0@switchHeight) ). window addMorph: self buildMorphicMessageCatList fullFrame: ( LayoutFrame fractions: (0@0 corner: 0.5@hSepFrac) offsets: (0@switchHeight corner: 0@0) ). window addMorph: self buildMorphicMessageList fullFrame: ( LayoutFrame fractions: (0.5@0 corner: 1.0@hSepFrac) offsets: (0@switchHeight corner: 0@0) ). window setUpdatablePanesFrom: #(messageCategoryList messageList). ^ window ! ! !Browser methodsFor: 'initialize-release' stamp: 'sps 4/3/2004 20:41'! openAsMorphEditing: editString "Create a pluggable version of all the morphs for a Browser in Morphic" | window hSepFrac | hSepFrac _ 0.4. window _ (SystemWindow labelled: 'later') model: self. "The method SystemWindow>>addMorph:fullFrame: checks scrollBarsOnRight, then adds the morph at the back if true, otherwise it is added in front. But flopout hScrollbars need the lowerpanes to be behind the upper ones in the draw order. Hence the value of scrollBarsOnRight affects the order in which the lowerpanes are added. " Preferences scrollBarsOnRight ifFalse: [self addLowerPanesTo: window at: (0@hSepFrac corner: 1@1) with: editString]. window addMorph: self buildMorphicSystemCatList frame: (0@0 corner: 0.25@hSepFrac). self addClassAndSwitchesTo: window at: (0.25@0 corner: 0.5@hSepFrac) plus: 0. window addMorph: self buildMorphicMessageCatList frame: (0.5@0 extent: 0.25@hSepFrac). window addMorph: self buildMorphicMessageList frame: (0.75@0 extent: 0.25@hSepFrac). Preferences scrollBarsOnRight ifTrue: [self addLowerPanesTo: window at: (0@hSepFrac corner: 1@1) with: editString]. window setUpdatablePanesFrom: #(systemCategoryList classList messageCategoryList messageList). ^ window ! ! !ChangeSorter methodsFor: 'creation' stamp: 'sps 4/3/2004 20:15'! openAsMorphIn: window rect: rect "Add a set of change sorter views to the given top view offset by the given amount. To create a single change sorter, call this once with an offset of 0@0. To create a dual change sorter, call it twice with offsets of 0@0 and 0.5@0." | csListHeight msgListHeight csMsgListHeight | contents _ ''. csListHeight _ 0.25. msgListHeight _ 0.25. csMsgListHeight _ csListHeight + msgListHeight. self addDependent: window. "so it will get changed: #relabel" "The method SystemWindow>>addMorph:fullFrame: checks scrollBarsOnRight, then adds the morph at the back if true, otherwise it is added in front. But flopout hScrollbars needs the crrentSelector pane to be behind the upper ones in the draw order. Hence the value of scrollBarsOnRight affects the order in which the lowerpanes are added." Preferences scrollBarsOnRight ifFalse: [window addMorph: (PluggableListMorphByItem on: self list: #messageList selected: #currentSelector changeSelected: #currentSelector: menu: #messageMenu:shifted: keystroke: #messageListKey:from:) frame: (((0@csListHeight extent: 1@msgListHeight) scaleBy: rect extent) translateBy: rect origin)]. window addMorph: ((PluggableListMorphByItem on: self list: #changeSetList selected: #currentCngSet changeSelected: #showChangeSetNamed: menu: #changeSetMenu:shifted: keystroke: #changeSetListKey:from:) autoDeselect: false) frame: (((0@0 extent: 0.5@csListHeight) scaleBy: rect extent) translateBy: rect origin). window addMorph: (PluggableListMorphByItem on: self list: #classList selected: #currentClassName changeSelected: #currentClassName: menu: #classListMenu:shifted: keystroke: #classListKey:from:) frame: (((0.5@0 extent: 0.5@csListHeight) scaleBy: rect extent) translateBy: rect origin). Preferences scrollBarsOnRight ifTrue: [window addMorph: (PluggableListMorphByItem on: self list: #messageList selected: #currentSelector changeSelected: #currentSelector: menu: #messageMenu:shifted: keystroke: #messageListKey:from:) frame: (((0@csListHeight extent: 1@msgListHeight) scaleBy: rect extent) translateBy: rect origin)]. self addLowerPanesTo: window at: (((0@csMsgListHeight corner: 1@1) scaleBy: rect extent) translateBy: rect origin) with: nil. ! ! !FileList2 class methodsFor: 'morphic ui' stamp: 'sps 4/3/2004 20:40'! morphicView | dir aFileList window fileListBottom midLine fileListTopOffset buttonPane | dir _ FileDirectory default. aFileList _ self new directory: dir. window _ (SystemWindow labelled: dir pathName) model: aFileList. fileListTopOffset _ (TextStyle defaultFont pointSize * 2) + 14. fileListBottom _ 0.4. midLine _ 0.4. buttonPane _ aFileList optionalButtonRow addMorph: (aFileList morphicPatternPane vResizing: #spaceFill; yourself). "The method SystemWindow>>addMorph:fullFrame: checks scrollBarsOnRight, then adds the morph at the back if true, otherwise it is added in front. But flopout hScrollbars need the lowerpanes to be behind the upper ones in the draw order. Hence the value of scrollBarsOnRight affects the order in which the lower pane is added. " Preferences scrollBarsOnRight ifFalse: [self addFullPanesTo: window from: { {aFileList morphicFileContentsPane. 0@fileListBottom corner: 1@1. nil}. {buttonPane. 0@0 corner: 1@0. 0@0 corner: 0@fileListTopOffset}. {aFileList morphicDirectoryTreePane. 0@0 corner: midLine@fileListBottom. 0@fileListTopOffset corner: 0@0}. {aFileList morphicFileListPane. midLine @ 0 corner: 1@fileListBottom. 0@fileListTopOffset corner: 0@0}. }] ifTrue: [self addFullPanesTo: window from: { {buttonPane. 0@0 corner: 1@0. 0@0 corner: 0@fileListTopOffset}. {aFileList morphicDirectoryTreePane. 0@0 corner: midLine@fileListBottom. 0@fileListTopOffset corner: 0@0}. {aFileList morphicFileListPane. midLine @ 0 corner: 1@fileListBottom. 0@fileListTopOffset corner: 0@0}. {aFileList morphicFileContentsPane. 0@fileListBottom corner: 1@1. nil}. }]. aFileList postOpen. ^ window ! ! !MulticolumnLazyListMorph methodsFor: 'scroll range' stamp: 'sps 4/2/2004 12:16'! hUnadjustedScrollRange "multi column list morphs don't use hScrollbars" ^0 ! ! !ScrollPane methodsFor: 'OBSOLETE' stamp: 'sps 4/3/2004 19:16'! hideScrollBar self deprecated: 'Please use vHideScrollBar or hHideScrollBar instead.'. ^self vHideScrollBar ! ! !ScrollPane methodsFor: 'OBSOLETE' stamp: 'sps 4/4/2004 12:21'! hideScrollBarIndefinitely self deprecated: 'Please use hideHScrollBarIndefinitely or hideVScrollBarIndefinitely instead.'. ^self hideScrollBarsIndefinitely: true ! ! !ScrollPane methodsFor: 'OBSOLETE' stamp: 'sps 4/3/2004 19:17'! leftoverScrollRange self deprecated: 'Please use vLeftoverScrollRange or hLeftoverScrollRange instead.'. ^self vLeftoverScrollRange ! ! !ScrollPane methodsFor: 'OBSOLETE' stamp: 'sps 4/3/2004 19:17'! resizeScrollBar self deprecated: 'Please use vResizeScrollBar or hResizeScrollBar instead.'. ^self vResizeScrollBar ! ! !ScrollPane methodsFor: 'OBSOLETE' stamp: 'sps 4/3/2004 19:18'! scrollBarValue: scrollValue self deprecated: 'Please use vScrollBarValue: or hScrollBarValue: instead.'. ^self vScrollBarValue: scrollValue ! ! !ScrollPane methodsFor: 'OBSOLETE' stamp: 'sps 4/3/2004 19:19'! scrollbarWidth self deprecated: 'Please use scrollBarThickness instead.'. ^self scrollBarThickness ! ! !ScrollPane methodsFor: 'OBSOLETE' stamp: 'sps 4/3/2004 19:19'! totalScrollRange self deprecated: 'Please use vTotalScrollRange or hTotalScrollRange instead.'. ^self vTotalScrollRange ! ! !ScrollPane methodsFor: 'OBSOLETE' stamp: 'sps 4/3/2004 19:21'! unadjustedScrollRange self deprecated: 'Please use vUnadjustedScrollRange or hUnadjustedScrollRange instead.'. ^self vUnadjustedScrollRange ! ! !ScrollPane methodsFor: 'access options' stamp: 'sps 4/4/2004 12:23'! alwaysShowHScrollBar: bool self setProperty: #hScrollBarAlways toValue: bool. self hHideOrShowScrollBar. ! ! !ScrollPane methodsFor: 'access options' stamp: 'sps 4/4/2004 12:25'! alwaysShowScrollBars: bool "Get rid of scroll bar for short panes that don't want it shown." self alwaysShowHScrollBar: bool; alwaysShowVScrollBar: bool. ! ! !ScrollPane methodsFor: 'access options' stamp: 'sps 4/4/2004 12:23'! alwaysShowVScrollBar: bool self setProperty: #vScrollBarAlways toValue: bool. self vHideOrShowScrollBar. ! ! !ScrollPane methodsFor: 'access options' stamp: 'sps 4/4/2004 12:23'! hideHScrollBarIndefinitely: bool "Get rid of scroll bar for short panes that don't want it shown." self setProperty: #noHScrollBarPlease toValue: bool. self hHideOrShowScrollBar. ! ! !ScrollPane methodsFor: 'access options' stamp: 'sps 4/4/2004 12:21'! hideScrollBarsIndefinitely: bool "Get rid of scroll bar for short panes that don't want it shown." self hideVScrollBarIndefinitely: bool. self hideHScrollBarIndefinitely: bool. ! ! !ScrollPane methodsFor: 'access options' stamp: 'sps 4/4/2004 12:23'! hideVScrollBarIndefinitely: bool "Get rid of scroll bar for short panes that don't want it shown." self setProperty: #noVScrollBarPlease toValue: bool. self vHideOrShowScrollBar. ! ! !ScrollPane methodsFor: 'access options' stamp: 'sps 4/4/2004 12:22'! showHScrollBarOnlyWhenNeeded: bool "Get rid of scroll bar for short panes that don't want it shown." self setProperty: #noHScrollBarPlease toValue: bool. self setProperty: #hScrollBarAlways toValue: bool. self hHideOrShowScrollBar. ! ! !ScrollPane methodsFor: 'access options' stamp: 'sps 4/4/2004 12:29'! showScrollBarsOnlyWhenNeeded: bool self showHScrollBarOnlyWhenNeeded: bool. self showVScrollBarOnlyWhenNeeded: bool. ! ! !ScrollPane methodsFor: 'access options' stamp: 'sps 4/4/2004 12:25'! showVScrollBarOnlyWhenNeeded: bool "Get rid of scroll bar for short panes that don't want it shown." self setProperty: #noVScrollBarPlease toValue: bool. self setProperty: #vScrollBarAlways toValue: bool. self vHideOrShowScrollBar. ! ! !ScrollPane methodsFor: 'initialization' stamp: 'sps 4/4/2004 12:18'! initializeScrollBars "initialize the receiver's scrollBar" (scrollBar _ ScrollBar new model: self slotName: 'vScrollBar') borderWidth: 1; borderColor: Color black. (hScrollBar _ ScrollBar new model: self slotName: 'hScrollBar') borderWidth: 1; borderColor: Color black. "" scroller _ TransformMorph new color: Color transparent. scroller offset: -3 @ 0. self addMorph: scroller. "" scrollBar initializeEmbedded: retractableScrollBar not. hScrollBar initializeEmbedded: retractableScrollBar not. retractableScrollBar ifFalse: [self addMorph: scrollBar; addMorph: hScrollBar]. Preferences alwaysShowVScrollbar ifTrue: [ self alwaysShowVScrollBar: true ]. Preferences alwaysHideHScrollbar ifTrue:[self hideHScrollBarIndefinitely: true ] ifFalse: [Preferences alwaysShowHScrollbar ifTrue: [ self alwaysShowHScrollBar: true ]]. ! ! !PluggableMultiColumnListMorph methodsFor: 'scrolling' stamp: 'sps 4/2/2004 12:16'! hUnadjustedScrollRange "multi column list morphs don't use hScrollbars" ^0 ! ! ScrollPane removeSelector: #alwaysShowHScrollBar! ScrollPane removeSelector: #alwaysShowScrollBars! ScrollPane removeSelector: #alwaysShowVScrollBar! ScrollPane removeSelector: #hideHScrollBarIndefinitely! ScrollPane removeSelector: #hideScrollBarsIndefinitely! ScrollPane removeSelector: #hideVScrollBarIndefinitely! ScrollPane removeSelector: #showHScrollBarOnlyWhenNeeded! ScrollPane removeSelector: #showScrollBarsOnlyWhenNeeded! ScrollPane removeSelector: #showVScrollBarOnlyWhenNeeded! "Postscript: Leave the line above, and replace the rest of this comment by a useful one. Executable statements should follow this comment, and should be separated by periods, with no exclamation points (!!). Be sure to put any further comments in double-quotes, like this one." Preferences preferenceAt: #alwaysHideHScrollbar ifAbsent: [Preferences addPreference: #alwaysHideHScrollbar category: #scrolling default: false balloonHelp: 'If true, avoid displaying horizontal scrollbars. Overrides alwaysShowHScrollbar.']. !