Marcel Taeumel uploaded a new version of PreferenceBrowser to project The Trunk:
http://source.squeak.org/trunk/PreferenceBrowser-mt.89.mcz ==================== Summary ==================== Name: PreferenceBrowser-mt.89 Author: mt Time: 15 August 2019, 12:00:45.543945 pm UUID: 8023ca53-7e04-8e46-98b7-a9e927923f26 Ancestors: PreferenceBrowser-ct.88 Some cosmetic improvements. Fixes "show category" button. =============== Diff against PreferenceBrowser-ct.88 =============== Item was changed: ----- Method: PBPreferenceButtonMorph>>addExtraControls (in category 'extra controls') ----- addExtraControls | m | m := self horizontalPanel cellInset: 3; addAllMorphs: self actionButtons; addMorphBack: self horizontalFiller; addMorphBack: self moreButton; yourself. self addMorphBack: (self blankSpaceOf: 2@2); addMorphBack: self preferenceHelpTextMorph; + addMorphBack: self horizontalLine; + addMorphBack: self preferenceCodeTextMorph; fullBounds; "to force a layout compute needed by the textMorphs's autoFit" addMorphBack: m ! Item was changed: ----- Method: PBPreferenceButtonMorph>>basicButton (in category 'utility methods') ----- basicButton + + ^ PluggableButtonMorph new + target: self; + layoutInset: (10@5 corner: 10@5); + yourself! - | button | - button := SimpleButtonMorph new. - button - borderWidth: 1; - borderColor: self paneColor; - on: #mouseEnter send: #value to: [button borderWidth: 2]; - on: #mouseLeave send: #value to: [button borderWidth: 1]; - vResizing: #rigid; - height: (TextStyle defaultFont height + 4); - useSquareCorners; - clipSubmorphs: true; - color: self paneColor muchLighter; - target: self. - ^button! Item was changed: ----- Method: PBPreferenceButtonMorph>>highlightOn (in category 'highlighting') ----- highlightOn self color: ((UserInterfaceTheme current get: #selectionColor for: PluggableListMorph) ifNil: [Color gray alpha: 0.1]). self label color: ((UserInterfaceTheme current get: #selectionTextColor for: PluggableListMorph) ifNil: [Color black]); + font: (((UserInterfaceTheme current get: #font for: PluggableListMorph) ifNil: [TextStyle defaultFont]) + emphasized: TextEmphasis bold emphasisCode). + - font: ((UserInterfaceTheme current get: #font for: PluggableListMorph) ifNil: [TextStyle defaultFont]). - self addExtraControls.! Item was added: + ----- Method: PBPreferenceButtonMorph>>horizontalLine (in category 'utility methods') ----- + horizontalLine + ^self horizontalPanel + hResizing: #spaceFill; + height: 2; + color: ((UserInterfaceTheme current get: #color for: PluggableListMorph) ifNil: [Color white]); + yourself.! Item was added: + ----- Method: PBPreferenceButtonMorph>>preferenceCode (in category 'preference accessing') ----- + preferenceCode + + ^ self preference codeString withBlanksTrimmed! Item was added: + ----- Method: PBPreferenceButtonMorph>>preferenceCodeText (in category 'preference accessing') ----- + preferenceCodeText + + | text | + text := self preferenceCode asText + addAttribute: (TextFontReference toFont: Preferences standardCodeFont); + yourself. + ^ (Smalltalk classNamed: #SHTextStylerST80) + ifNil: [text] + ifNotNil: [:stylerClass | stylerClass new styledTextFor: text]! Item was added: + ----- Method: PBPreferenceButtonMorph>>preferenceCodeTextMorph (in category 'extra controls') ----- + preferenceCodeTextMorph + | text tm | + text := self preferenceCodeText. + tm := TextMorph new + contents: text; + wrapFlag: true; + autoFit: true; + hResizing: #spaceFill; + vResizing: #shrinkWrap; + margins: (5@0 corner: 5@0); + visible: text notEmpty; + yourself. "we don't want an empty textmorph showing" + ^tm! Item was changed: ----- Method: PBPreferenceButtonMorph>>preferenceHelpTextMorph (in category 'extra controls') ----- preferenceHelpTextMorph | text tm | text := self preferenceHelpText. tm := TextMorph new contents: text; wrapOnOff; hResizing: #spaceFill; vResizing: #shrinkWrap; + margins: (5@0 corner: 5@0); lock: true; visible: text notEmpty; yourself. "we don't want an empty textmorph showing" tm isAutoFit ifFalse: [tm autoFitOnOff]. ^tm.! Item was changed: ----- Method: PBPreferenceView>>basicPanel (in category 'user interface') ----- basicPanel ^BorderedMorph new beTransparent; extent: 0@0; borderWidth: 0; layoutInset: 0; + cellInset: 5; - cellInset: 2; layoutPolicy: TableLayout new; listCentering: #topLeft; cellPositioning: #center; hResizing: #shrinkWrap; vResizing: #shrinkWrap; yourself! Item was changed: ----- Method: PBPreferenceView>>offerPreferenceNameMenu: (in category 'user interface') ----- offerPreferenceNameMenu: aPreferenceBrowser "the user clicked on a preference name -- put up a menu" + | aMenu readableName | + readableName := self preference readableName. - | aMenu | aMenu := MenuMorph new defaultTarget: self preference; + addTitle: readableName. - addTitle: self preference name. (Preferences okayToChangeProjectLocalnessOf: self preference name) ifTrue: [aMenu addUpdating: #isProjectLocalString target: self preference action: #toggleProjectLocalness; balloonTextForLastItem: 'Some preferences are best applied uniformly to all projects, and others are best set by each individual project. If this item is checked, then this preference will be printed in bold and will have a separate value for each project']. aMenu + addLine; add: 'browse senders' translated target: self systemNavigation selector: #browseAllSelect:name:autoSelect: argumentList: { [:m | self preference selectors anySatisfy: [:sel | m hasLiteral: sel]]. 'Preference senders: {1}' translated format: {self preference name}. self preference selectors first }; balloonTextForLastItem: 'This will open a method-list browser on all methods that the send the preference "' + , readableName , '".'. - , self preference name , '".'. self preference provider ifNotNil: [ aMenu add: 'browse implementation' translated + target: ToolSet + selector: #browse:selector: - target: Browser - selector: #fullOnClass:selector: argumentList: { self preference provider class. self preference selectors first }; + balloonTextForLastItem: 'This will open a browser on the method that stores the preference "' , readableName , '".']. - balloonTextForLastItem: 'This will open a browser on the method that stores the preference "' , self preference name , '".']. aMenu add: 'inspect preference' translated target: self preference selector: #inspect; + balloonTextForLastItem: 'This will open an Inspector on the preference "' , readableName , '".'. - balloonTextForLastItem: 'This will open an Inspector on the preference "' , self preference name , '".'. aMenu + addLine; + add: 'show category' - add: 'show category...' target: aPreferenceBrowser selector: #findCategoryFromPreference: + argument: self preference; - argument: self preference name; balloonTextForLastItem: 'Allows you to find out which category, or categories, this preference belongs to.'. Smalltalk isMorphic ifTrue: [aMenu add: 'hand me a button for this preference' target: self selector: #tearOffButton; balloonTextForLastItem: 'Will give you a button that governs this preference, which you may deposit wherever you wish']. aMenu + add: 'copy name to clipboard' - add: 'copy this name to clipboard' target: self preference selector: #copyName; balloonTextForLastItem: 'Copy the name of the preference to the text clipboard, so that you can paste into code somewhere'. + aMenu + add: 'copy code to clipboard' + target: self preference + selector: #copyCode; + balloonTextForLastItem: 'Copy the code to access the current preference value to the clipboard, so that you can paste into code somewhere'. aMenu popUpInWorld! Item was changed: ----- Method: PreferenceBrowser>>findCategoryFromPreference: (in category 'find') ----- + findCategoryFromPreference: aPreference - findCategoryFromPreference: prefSymbol "Find all categories in which the preference occurs" | aMenu| aMenu := MenuMorph new defaultTarget: self. + aPreference categoryList do: - (preferences categoryListOfPreference: prefSymbol) do: [:aCategory | aMenu add: aCategory target: self selector: #selectedCategory: argument: aCategory]. aMenu popUpInWorld! Item was changed: ----- Method: PreferenceView>>morphForName (in category 'user interface') ----- morphForName + ^ ((StringMorph contents: self preference readableName) - ^ ((StringMorph contents: self preference name) color: ((UserInterfaceTheme current get: #textColor for: PluggableListMorph) ifNil: [Color black]); font: ((UserInterfaceTheme current get: #font for: PluggableListMorph) ifNil: [TextStyle defaultFont]); yourself)! |
|
Free forum by Nabble | Edit this page |