Eliot Miranda uploaded a new version of PreferenceBrowser to project The Trunk:
http://source.squeak.org/trunk/PreferenceBrowser-eem.80.mcz ==================== Summary ==================== Name: PreferenceBrowser-eem.80 Author: eem Time: 3 April 2017, 4:25:44.198454 pm UUID: 934a50d9-f957-43d2-8ce8-ba5f7f4ee104 Ancestors: PreferenceBrowser-ul.79 Add a #Class type preference view (this code was contributed by Marcel Taumael and gratefully received by the publisher who will use it to select bytecode sets). =============== Diff against PreferenceBrowser-ul.79 =============== Item was added: + PBTextPreferenceView subclass: #PBClassPreferenceView + instanceVariableNames: 'styler completionController' + classVariableNames: '' + poolDictionaries: '' + category: 'PreferenceBrowser'! Item was added: + ----- Method: PBClassPreferenceView class>>initialize (in category 'as yet unclassified') ----- + initialize + PreferenceViewRegistry ofClassPreferences register: self.! Item was added: + ----- Method: PBClassPreferenceView class>>unload (in category 'as yet unclassified') ----- + unload + "Unload order is not guaranteed so guard against failure" + [PreferenceViewRegistry ofClassPreferences unregister: self] on: Error do:[]! Item was added: + ----- Method: PBClassPreferenceView>>aboutToStyle: (in category 'styling') ----- + aboutToStyle: styler + "For Shout styling support." + ^ true! Item was added: + ----- Method: PBClassPreferenceView>>completionController (in category 'auto completion') ----- + completionController + "For OCompletion support." + ^ completionController! Item was added: + ----- Method: PBClassPreferenceView>>initialize (in category 'initialize-release') ----- + initialize + super initialize. + styler := (Smalltalk classNamed: 'SHTextStylerST80') ifNotNil: [:s | s new]. + completionController := (Smalltalk classNamed: 'OController') ifNotNil: [:oc | oc model: self].! Item was added: + ----- Method: PBClassPreferenceView>>preferenceValue (in category 'user interface') ----- + preferenceValue + ^self preference preferenceValue ifNil: [''] ifNotNil: [:cls | cls name]! Item was added: + ----- Method: PBClassPreferenceView>>preferenceValue: (in category 'user interface') ----- + preferenceValue: aClassName + + | newClass | + newClass := Smalltalk classNamed: aClassName asString withBlanksTrimmed. + + "Avoid overwriting the previous setting by mistake unless explicitely stated so." + (newClass notNil or: [aClassName = 'nil']) + ifTrue: [self preference preferenceValue: newClass]. + + ^ true! Item was added: + ----- Method: PBClassPreferenceView>>selectedClassOrMetaClass (in category 'auto completion') ----- + selectedClassOrMetaClass + "For OCompletion support." + ^ nil! Item was added: + ----- Method: PBClassPreferenceView>>textField (in category 'user interface') ----- + textField + + | field | + field := PluggableTextMorphPlus + on: self + text: #preferenceValue + accept: #preferenceValue:. + field + hideScrollBarsIndefinitely; + acceptOnCR: true; + minimumHeight: 0; + vResizing: #rigid; + hResizing: #spaceFill; + height: TextStyle defaultFont height + 6. + + styler ifNotNil: [:s | field styler: (s view: field)]. + + ^ field! Item was changed: ----- Method: PreferenceViewRegistry class>>forType: (in category 'accessing') ----- forType: typeName "Answer the preference registry for the given type name" ^typeName caseOf:{ [#Boolean] -> [self ofBooleanPreferences]. [#Color] -> [self ofColorPreferences]. [#Font] -> [self ofFontPreferences]. [#Number] -> [self ofNumericPreferences]. [#String] -> [self ofTextPreferences]. + [#Class] -> [self ofClassPreferences]. [#Halo] -> [self ofHaloThemePreferences]. [#WindowColor] -> [self registryOf: #windowColorPreferences] } otherwise:[self registryOf: typeName].! Item was added: + ----- Method: PreferenceViewRegistry class>>ofClassPreferences (in category 'instance creation') ----- + ofClassPreferences + ^(self registryOf: #classPreferences) + viewOrder: 3; + yourself.! Item was changed: ----- Method: PreferenceViewRegistry class>>typeOfRegistry: (in category 'accessing') ----- typeOfRegistry: aRegistry "Answer the type name for a particular view registry" ^aRegistry caseOf:{ [self ofBooleanPreferences] -> [#Boolean]. [self ofColorPreferences] -> [#Color]. [self ofFontPreferences] -> [#Font]. [self ofNumericPreferences] -> [#Number]. [self ofTextPreferences] -> [#String]. + [self ofClassPreferences] -> [#Class]. [self ofHaloThemePreferences] -> [#Halo]. [self registryOf: #windowColorPreferences] -> [#WindowColor]. } otherwise:[self registries keyAtIdentityValue: aRegistry ifAbsent:[nil]].! |
Free forum by Nabble | Edit this page |