--- a/AbstractSettingsApplication.st Thu Nov 19 10:10:23 2015 +0000
+++ b/AbstractSettingsApplication.st Fri Nov 20 06:48:55 2015 +0100
@@ -21,6 +21,14 @@
category:'Interface-Smalltalk'
!
+AbstractSettingsApplication subclass:#AllSettingsAppl
+ instanceVariableNames:'buildDirectory localBuild selectedCompiler usedCompilerForBuild
+ selectedSettingHolder settingsList'
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:AbstractSettingsApplication
+!
+
AbstractSettingsApplication subclass:#BuildSettingsAppl
instanceVariableNames:'buildDirectory localBuild selectedCompiler usedCompilerForBuild'
classVariableNames:''
@@ -913,6 +921,303 @@
^ settingsDialog getNameOfApplication:self.
! !
+!AbstractSettingsApplication::AllSettingsAppl class methodsFor:'documentation'!
+
+documentation
+"
+ this little app provides an alternative view on all settings keys.
+ This offers a name-list of settings values, and thus allows for
+ settings to be changed for which no 'real' UI has been programmed.
+ (i.e. a fallback for missing things)
+"
+! !
+
+!AbstractSettingsApplication::AllSettingsAppl class methodsFor:'help specs'!
+
+flyByHelpSpec
+ "This resource specification was automatically generated
+ by the UIHelpTool of ST/X."
+
+ "Do not manually edit this!! If it is corrupted,
+ the UIHelpTool may not be able to read the specification."
+
+ "
+ UIHelpTool openOnClass:AbstractSettingsApplication::ByteCodeCompilerSettingsAppl
+ "
+
+ <resource: #help>
+
+ ^ super flyByHelpSpec addPairsFrom: self helpPairs
+!
+
+helpPairs
+ "This resource specification was automatically generated
+ by the UIHelpTool of ST/X."
+
+ "Do not manually edit this!! If it is corrupted,
+ the UIHelpTool may not be able to read the specification."
+
+ "
+ UIHelpTool openOnClass:AbstractSettingsApplication::ByteCodeCompilerSettingsAppl
+ "
+
+ <resource: #help>
+
+ ^ #(
+
+
+)
+! !
+
+!AbstractSettingsApplication::AllSettingsAppl class methodsFor:'image specs'!
+
+defaultIcon
+ <resource: #programImage>
+
+ ^ super defaultIcon
+! !
+
+!AbstractSettingsApplication::AllSettingsAppl class methodsFor:'interface specs'!
+
+windowSpec
+ "This resource specification was automatically generated
+ by the UIPainter of ST/X."
+
+ "Do not manually edit this!! If it is corrupted,
+ the UIPainter may not be able to read the specification."
+
+ "
+ UIPainter new openOnClass:AbstractSettingsApplication::AllSettingsAppl andSelector:#windowSpec
+ AbstractSettingsApplication::AllSettingsAppl new openInterface:#windowSpec
+ AbstractSettingsApplication::AllSettingsAppl open
+ "
+
+ <resource: #canvas>
+
+ ^
+ #(FullSpec
+ name: windowSpec
+ window:
+ (WindowSpec
+ label: 'All Settings'
+ name: 'All Settings'
+ min: (Point 10 10)
+ bounds: (Rectangle 0 0 659 242)
+ )
+ component:
+ (SpecCollection
+ collection: (
+ (DataSetSpec
+ name: 'Table1'
+ layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+ model: selectedSettingHolder
+ hasHorizontalScrollBar: true
+ hasVerticalScrollBar: true
+ dataList: settingsList
+ columns:
+ (OrderedCollection
+
+ (DataSetColumnSpec
+ label: 'Name'
+ labelButtonType: Button
+ height: heightOfFirstRow
+ model: key
+ menuFromApplication: false
+ )
+ (DataSetColumnSpec
+ label: 'Value'
+ labelButtonType: Button
+ height: heightOfFirstRow
+ model: value
+ menuFromApplication: false
+ )
+ )
+ )
+ )
+
+ )
+ )
+! !
+
+!AbstractSettingsApplication::AllSettingsAppl methodsFor:'actions'!
+
+basicReadSettings
+ super basicReadSettings.
+
+ usedCompilerForBuild value isNil ifTrue:[
+ currentUserPrefs usedCompilerForBuild:(Tools::ProjectBuilder defaultUsedCompiler).
+ usedCompilerForBuild value:(Tools::ProjectBuilder defaultUsedCompiler).
+ ].
+
+ "Modified: / 26-07-2012 / 23:16:52 / cg"
+!
+
+basicSaveSettings
+ |buildDir|
+
+ buildDir := buildDirectory value.
+ buildDir notEmptyOrNil ifTrue:[
+ buildDir := buildDir asFilename.
+ buildDir isDirectory ifFalse:[
+ (Dialog confirm:(resources
+ stringWithCRs:'Build directory %1 does not exist.\\Create?'
+ with:buildDir pathName allBold))
+ ifTrue:[
+ buildDir makeDirectory.
+ ]
+ ].
+ ].
+
+ super basicSaveSettings.
+
+ "Modified: / 22-01-2012 / 10:50:09 / cg"
+!
+
+cleanupBuildDirectory
+ |buildDir|
+
+ buildDir := buildDirectory value.
+ buildDir isEmptyOrNil ifTrue:[
+ ^ self.
+ ].
+ buildDir := buildDir asFilename.
+ (buildDir exists and:[Dialog confirm:('Really delete <1p> ?' expandMacrosWith:buildDir physicalPathName)]) ifTrue:[
+ buildDir recursiveRemove.
+ buildDir makeDirectory.
+ ].
+! !
+
+!AbstractSettingsApplication::AllSettingsAppl methodsFor:'aspects'!
+
+aspects
+ ^ #(
+ buildDirectory
+ localBuild
+ usedCompilerForBuild
+ )
+!
+
+buildDirectory
+ buildDirectory isNil ifTrue:[
+ buildDirectory := ValueHolder new.
+ buildDirectory onChangeSend:#updateModifiedChannel to:self
+ ].
+ ^ buildDirectory.
+!
+
+fetchSettingsList
+ |list|
+
+ list := List new.
+ UserPreferences selectorsAndMethodsDo:[:sel :mthd|
+ |setter getter getterMethod|
+
+ sel numArgs == 1 ifTrue:[
+ (sel endsWith:$:) ifTrue:[
+ setter := sel.
+ getter := sel copyButLast asSymbolIfInterned.
+ getter notNil ifTrue:[
+ (UserPreferences implements:getter) ifTrue:[
+ getterMethod := UserPreferences compiledMethodAt:getter.
+ getterMethod isObsolete ifFalse:[
+ list add:(sel -> (UserPreferences current perform:getter)).
+ ].
+ ].
+ ].
+ ].
+ ].
+ ].
+ list sortBySelector:#key.
+ ^ list
+!
+
+hasSourceCodeManager
+ ^ SourceCodeManager notNil
+!
+
+listOfPossibleCompilers
+ ^ Tools::ProjectBuilder listOfPossibleCompilers
+
+ "Created: / 21-01-2012 / 14:05:43 / cg"
+!
+
+localBuild
+ localBuild isNil ifTrue:[
+ localBuild := UserPreferences current localBuild asValue.
+ localBuild onChangeSend:#updateModifiedChannel to:self
+ ].
+ ^ localBuild.
+!
+
+selectedSettingHolder
+ <resource: #uiAspect>
+
+ "automatically generated by UIPainter ..."
+
+ "*** the code below creates a default model when invoked."
+ "*** (which may not be the one you wanted)"
+ "*** Please change as required and accept it in the browser."
+ "*** (and replace this comment by something more useful ;-)"
+
+ selectedSettingHolder isNil ifTrue:[
+ selectedSettingHolder := ValueHolder new.
+"/ if your app needs to be notified of changes, uncomment one of the lines below:
+"/ selectedSettingHolder addDependent:self.
+"/ selectedSettingHolder onChangeSend:#selectedSettingHolderChanged to:self.
+ ].
+ ^ selectedSettingHolder.
+!
+
+settingsList
+ <resource: #uiAspect>
+
+ "automatically generated by UIPainter ..."
+
+ "*** the code below creates a default model when invoked."
+ "*** (which may not be the one you wanted)"
+ "*** Please change as required and accept it in the browser."
+ "*** (and replace this comment by something more useful ;-)"
+
+ settingsList isNil ifTrue:[
+ settingsList := self fetchSettingsList.
+
+ ].
+ ^ settingsList.
+!
+
+usedCompilerForBuild
+ usedCompilerForBuild isNil ifTrue:[
+ usedCompilerForBuild := nil asValue.
+ usedCompilerForBuild onChangeSend:#updateModifiedChannel to:self
+ ].
+ ^ usedCompilerForBuild.
+
+ "Created: / 22-01-2012 / 10:59:30 / cg"
+! !
+
+!AbstractSettingsApplication::AllSettingsAppl methodsFor:'help'!
+
+helpFilename
+ ^ 'Launcher/buildSetup.html'
+! !
+
+!AbstractSettingsApplication::AllSettingsAppl methodsFor:'initialization'!
+
+postBuildDirectoryField:aField
+ aField historyList value:(Array
+ with:(OperatingSystem getHomeDirectory asFilename construct:'stx_build') pathName
+ with:(Filename currentDirectory construct:'stx_build') pathName)
+! !
+
+!AbstractSettingsApplication::AllSettingsAppl methodsFor:'queries'!
+
+hasUnsavedChanges
+ (super hasUnsavedChanges) ifTrue:[^ true].
+ ^ false
+
+ "Modified: / 22-01-2012 / 10:50:15 / cg"
+! !
+
!AbstractSettingsApplication::BuildSettingsAppl class methodsFor:'help specs'!
flyByHelpSpec
@@ -6538,8 +6843,8 @@
readLanguagesFile := rsc notNil and:[(rsc at:#languageFileExists ifAbsent:false) == true].
listOfLanguageKeys do:[:eachLang |
- savedLanguage := Language.
- savedLanguageTerritory := LanguageTerritory.
+ savedLanguage := Smalltalk language.
+ savedLanguageTerritory := Smalltalk languageTerritory.
readLanguagesFile ifFalse:[
ResourcePack flushCachedResourcePacks.
].
@@ -6552,8 +6857,7 @@
terr := lang copyFrom:4.
lang := lang copyTo:2.
].
- Language := lang asSymbol.
- LanguageTerritory := terr asSymbol.
+ Smalltalk setLanguage:lang asSymbol territory:terr asSymbol.
readLanguagesFile ifTrue:[
rsc := ResourcePack forPackage:'stx:libtool' resourceFileName:'languages.rs' cached:false.
] ifFalse:[
@@ -6561,8 +6865,7 @@
].
perLanguageResources at:eachLang asSymbol put:rsc.
] ensure:[
- Language := savedLanguage.
- LanguageTerritory := savedLanguageTerritory.
+ Smalltalk setLanguage:savedLanguage territory:savedLanguageTerritory.
].
].
readLanguagesFile ifFalse:[
@@ -6704,23 +7007,26 @@
!
currentLanguageIndex
- | langIdx |
-
- (Language ~= LanguageTerritory) ifTrue:[
- langIdx := listOfLanguages indexOf:(Language , '-' , LanguageTerritory) ifAbsent:nil.
- ].
- langIdx isNil ifTrue:[
- langIdx := listOfLanguages indexOf:Language ifAbsent:nil.
+ | lang terr langIdx |
+
+ lang := Smalltalk language.
+ terr := Smalltalk languageTerritory.
+
+ (lang ~= terr) ifTrue:[
+ langIdx := listOfLanguages indexOf:(lang , '-' , terr) ifAbsent:nil.
].
langIdx isNil ifTrue:[
- langIdx := listOfLanguages indexOf:'en' ifAbsent:nil.
- langIdx isNil ifTrue:[
- langIdx := listOfLanguages indexOf:'en-us' ifAbsent:nil.
-
- langIdx isNil ifTrue:[
- langIdx := 1.
- ]
- ]
+ langIdx := listOfLanguages indexOf:lang ifAbsent:nil.
+ ].
+ langIdx isNil ifTrue:[
+ langIdx := listOfLanguages indexOf:'en' ifAbsent:nil.
+ langIdx isNil ifTrue:[
+ langIdx := listOfLanguages indexOf:'en-us' ifAbsent:nil.
+
+ langIdx isNil ifTrue:[
+ langIdx := 1.
+ ]
+ ]
].
^ langIdx
!