#REFACTORING
class: AbstractSettingsApplication
eliminated references to Language global
--- a/AbstractSettingsApplication.st Thu Nov 19 14:55:55 2015 +0100
+++ b/AbstractSettingsApplication.st Thu Nov 19 15:36:14 2015 +0100
@@ -21,6 +21,13 @@
category:'Interface-Smalltalk'
!
+AbstractSettingsApplication subclass:#AllSettingsAppl
+ instanceVariableNames:'buildDirectory localBuild selectedCompiler usedCompilerForBuild'
+ classVariableNames:''
+ poolDictionaries:''
+ privateIn:AbstractSettingsApplication
+!
+
AbstractSettingsApplication subclass:#BuildSettingsAppl
instanceVariableNames:'buildDirectory localBuild selectedCompiler usedCompilerForBuild'
classVariableNames:''
@@ -913,6 +920,341 @@
^ 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::BuildSettingsAppl andSelector:#windowSpec
+ AbstractSettingsApplication::BuildSettingsAppl new openInterface:#windowSpec
+ AbstractSettingsApplication::BuildSettingsAppl open
+ "
+
+ <resource: #canvas>
+
+ ^
+ #(FullSpec
+ name: windowSpec
+ window:
+ (WindowSpec
+ label: 'Build Settings'
+ name: 'Build Settings'
+ min: (Point 10 10)
+ bounds: (Rectangle 0 0 659 242)
+ )
+ component:
+ (SpecCollection
+ collection: (
+ (VerticalPanelViewSpec
+ name: 'VerticalPanel3'
+ layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+ horizontalLayout: fit
+ verticalLayout: top
+ horizontalSpace: 3
+ verticalSpace: 4
+ component:
+ (SpecCollection
+ collection: (
+ (FramedBoxSpec
+ label: 'Build Directory'
+ name: 'FramedBox1'
+ labelPosition: topLeft
+ translateLabel: true
+ component:
+ (SpecCollection
+ collection: (
+ (ViewSpec
+ name: 'LocalBuild'
+ layout: (LayoutFrame 0 0.0 0 0 0 1.0 25 0)
+ activeHelpKey: localBuild
+ component:
+ (SpecCollection
+ collection: (
+ (CheckBoxSpec
+ label: 'Local Build (Do not use Repository)'
+ name: 'CheckBox4'
+ layout: (LayoutFrame 2 0 5 0 -5 1 27 0)
+ enableChannel: hasSourceCodeManager
+ activeHelpKey: localBuild
+ model: localBuild
+ translateLabel: true
+ )
+ )
+
+ )
+ )
+ (ViewSpec
+ name: 'Build Directory'
+ layout: (LayoutFrame 0 0 40 0 0 1 70 0)
+ component:
+ (SpecCollection
+ collection: (
+ (LabelSpec
+ label: 'Build Directory:'
+ name: 'BuildDirDirLabel'
+ layout: (LayoutFrame 0 0.0 0 0 60 0.25 22 0)
+ translateLabel: true
+ adjust: right
+ activeHelpKey: buildDirectory
+ )
+ (FilenameInputFieldSpec
+ name: 'FilenameEntryField1'
+ layout: (LayoutFrame 221 0 0 0 0 1 22 0)
+ enableChannel: localBuild
+ model: buildDirectory
+ acceptOnReturn: true
+ acceptOnTab: true
+ acceptOnLostFocus: true
+ acceptOnPointerLeave: true
+ viewClassName: FilenameWidgetWithHistory
+ postBuildCallback: postBuildDirectoryField:
+ activeHelpKey: buildDirectory
+ )
+ )
+
+ )
+ )
+ (HorizontalPanelViewSpec
+ name: 'ActionsHorizontalPanel'
+ layout: (LayoutFrame 62 0.25 67 0 0 1 96 0)
+ horizontalLayout: fitSpace
+ verticalLayout: center
+ horizontalSpace: 3
+ verticalSpace: 3
+ component:
+ (SpecCollection
+ collection: (
+ (ActionButtonSpec
+ label: 'Cleanup Build Directory'
+ name: 'CleanupBuildDirectoryButton'
+ translateLabel: true
+ tabable: true
+ model: cleanupBuildDirectory
+ extent: (Point 401 22)
+ )
+ )
+
+ )
+ )
+ )
+
+ )
+ extent: (Point 659 128)
+ )
+ (ViewSpec
+ name: 'Box1'
+ component:
+ (SpecCollection
+ collection: (
+ (LabelSpec
+ label: 'Compiler for Build:'
+ name: 'Label1'
+ layout: (LayoutFrame 0 0 0 0 150 0 22 0)
+ translateLabel: true
+ adjust: right
+ )
+ (ComboListSpec
+ name: 'ComboList1'
+ layout: (LayoutFrame 150 0 0 0 300 0 20 0)
+ model: usedCompilerForBuild
+ comboList: listOfPossibleCompilers
+ useIndex: false
+ )
+ )
+
+ )
+ extent: (Point 659 25)
+ )
+ )
+
+ )
+ )
+ )
+
+ )
+ )
+
+ "Modified: / 22-01-2012 / 10:59:44 / cg"
+! !
+
+!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.
+!
+
+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.
+!
+
+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 +6880,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 +6894,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 +6902,7 @@
].
perLanguageResources at:eachLang asSymbol put:rsc.
] ensure:[
- Language := savedLanguage.
- LanguageTerritory := savedLanguageTerritory.
+ Smalltalk setLanguage:savedLanguage territory:savedLanguageTerritory.
].
].
readLanguagesFile ifFalse:[
@@ -6704,23 +7044,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
!