initial checkin
authorpenk
Tue, 26 Nov 2002 16:52:52 +0100
changeset 4318 a1cdf6b7bd10
parent 4317 bf3f150809c2
child 4319 1cfd366098a2
initial checkin
FileBrowserV2SettingsAppl.st
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FileBrowserV2SettingsAppl.st	Tue Nov 26 16:52:52 2002 +0100
@@ -0,0 +1,606 @@
+"{ Package: 'stx:libtool' }"
+
+AbstractSettingsApplication subclass:#FileBrowserV2SettingsAppl
+	instanceVariableNames:'modifiedChannel viewFilesInDirectoryTree viewDescription
+		sortDirectoriesBeforeFiles showDirectoryTree viewSize viewType
+		viewPermissions viewGroup viewDirsInContentsBrowser viewDetails
+		sortCaseless showHiddenFiles openMultipleApplicationsForType
+		viewOwner toolBarVisibleHolder viewDirectoryDescription
+		openAlwaysInTextEditor viewPreview viewTime
+		filenameEntryFieldVisibleHolder currentUserPrefs'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Interface-Tools-File'
+!
+
+
+!FileBrowserV2SettingsAppl class methodsFor:'icon'!
+
+defaultIcon
+
+    ^ FileBrowserV2 applicationIcon
+! !
+
+!FileBrowserV2SettingsAppl 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:FileBrowserV2SettingsAppl andSelector:#windowSpec
+     FileBrowserV2SettingsAppl new openInterface:#windowSpec
+     FileBrowserV2SettingsAppl open
+    "
+
+    <resource: #canvas>
+
+    ^ 
+     #(#FullSpec
+        #name: #windowSpec
+        #window: 
+       #(#WindowSpec
+          #label: 'Settings'
+          #name: 'Settings'
+          #min: #(#Point 10 10)
+          #max: #(#Point 1024 768)
+          #bounds: #(#Rectangle 16 42 450 567)
+        )
+        #component: 
+       #(#SpecCollection
+          #collection: #(
+           #(#VerticalPanelViewSpec
+              #name: 'VerticalPanel1'
+              #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
+              #horizontalLayout: #fit
+              #verticalLayout: #center
+              #horizontalSpace: 3
+              #verticalSpace: 3
+              #component: 
+             #(#SpecCollection
+                #collection: #(
+                 #(#VerticalPanelViewSpec
+                    #name: 'VerticalPanel2'
+                    #horizontalLayout: #fit
+                    #verticalLayout: #center
+                    #horizontalSpace: 3
+                    #verticalSpace: 3
+                    #component: 
+                   #(#SpecCollection
+                      #collection: #(
+                       #(#FramedBoxSpec
+                          #label: 'Show'
+                          #name: 'FramedBox1'
+                          #labelPosition: #topLeft
+                          #translateLabel: true
+                          #component: 
+                         #(#SpecCollection
+                            #collection: #(
+                             #(#CheckBoxSpec
+                                #label: 'Hidden Files'
+                                #name: 'CheckBox1'
+                                #layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 20 0)
+                                #model: #showHiddenFiles
+                                #translateLabel: true
+                              )
+                             #(#CheckBoxSpec
+                                #label: 'Directory Tree'
+                                #name: 'CheckBox2'
+                                #layout: #(#LayoutFrame 0 0.0 25 0 0 1.0 45 0)
+                                #model: #showDirectoryTree
+                                #translateLabel: true
+                              )
+                             #(#CheckBoxSpec
+                                #label: 'Regular Files in TreeView (Left)'
+                                #name: 'CheckBox3'
+                                #layout: #(#LayoutFrame 20 0 50 0 0 1.0 70 0)
+                                #model: #viewFilesInDirectoryTree
+                                #translateLabel: true
+                              )
+                             #(#CheckBoxSpec
+                                #label: 'Directories in ContentsView (Right)'
+                                #name: 'CheckBox4'
+                                #layout: #(#LayoutFrame 0 0.0 75 0 0 1.0 95 0)
+                                #model: #viewDirsInContentsBrowser
+                                #translateLabel: true
+                              )
+                             #(#CheckBoxSpec
+                                #label: 'Toolbar'
+                                #name: 'CheckBox11'
+                                #layout: #(#LayoutFrame 0 0.0 100 0 0 1.0 120 0)
+                                #model: #toolBarVisibleHolder
+                                #translateLabel: true
+                              )
+                             #(#CheckBoxSpec
+                                #label: 'Path Entry && Filter'
+                                #name: 'CheckBox12'
+                                #layout: #(#LayoutFrame 0 0.0 125 0 0 1.0 145 0)
+                                #model: #filenameEntryFieldVisibleHolder
+                                #translateLabel: true
+                              )
+                             )
+                           
+                          )
+                          #extent: #(#Point 434 175)
+                        )
+                       #(#FramedBoxSpec
+                          #label: 'Sort'
+                          #name: 'FramedBox2'
+                          #labelPosition: #topLeft
+                          #translateLabel: true
+                          #component: 
+                         #(#SpecCollection
+                            #collection: #(
+                             #(#CheckBoxSpec
+                                #label: 'Ignore Case in Sort'
+                                #name: 'CheckBox6'
+                                #layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 20 0)
+                                #model: #sortCaseless
+                                #translateLabel: true
+                              )
+                             #(#CheckBoxSpec
+                                #label: 'Directories before Files'
+                                #name: 'CheckBox7'
+                                #layout: #(#LayoutFrame 0 0.0 25 0 0 1.0 45 0)
+                                #model: #sortDirectoriesBeforeFiles
+                                #translateLabel: true
+                              )
+                             )
+                           
+                          )
+                          #extent: #(#Point 434 75)
+                        )
+                       #(#FramedBoxSpec
+                          #label: 'Application Notebook'
+                          #name: 'FramedBox3'
+                          #labelPosition: #topLeft
+                          #translateLabel: true
+                          #component: 
+                         #(#SpecCollection
+                            #collection: #(
+                             #(#CheckBoxSpec
+                                #label: 'Open Always in Text Editor'
+                                #name: 'CheckBox8'
+                                #layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 20 0)
+                                #model: #openAlwaysInTextEditor
+                                #translateLabel: true
+                              )
+                             #(#CheckBoxSpec
+                                #label: 'Open Multiple Applications'
+                                #name: 'CheckBox9'
+                                #layout: #(#LayoutFrame 0 0.0 25 0 0 1.0 45 0)
+                                #model: #openMultipleApplicationsForType
+                                #translateLabel: true
+                              )
+                             #(#CheckBoxSpec
+                                #label: 'Auto Open Directory Description'
+                                #name: 'CheckBox10'
+                                #layout: #(#LayoutFrame 0 0.0 50 0 0 1.0 70 0)
+                                #model: #viewDirectoryDescription
+                                #translateLabel: true
+                              )
+                             )
+                           
+                          )
+                          #extent: #(#Point 434 100)
+                        )
+                       #(#FramedBoxSpec
+                          #label: 'Show Columns in Contents Browser'
+                          #name: 'FramedBox4'
+                          #labelPosition: #topLeft
+                          #translateLabel: true
+                          #component: 
+                         #(#SpecCollection
+                            #collection: #(
+                             #(#CheckBoxSpec
+                                #label: 'Details'
+                                #name: 'CheckBox22'
+                                #layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 20 0)
+                                #model: #viewDetails
+                                #translateLabel: true
+                              )
+                             #(#CheckBoxSpec
+                                #label: 'Suffix'
+                                #name: 'CheckBox13'
+                                #layout: #(#LayoutFrame 20 0.0 25 0 170 0 45 0)
+                                #enableChannel: #viewDetails
+                                #model: #viewType
+                                #translateLabel: true
+                              )
+                             #(#CheckBoxSpec
+                                #label: 'Permissions'
+                                #name: 'CheckBox21'
+                                #layout: #(#LayoutFrame 170 0.0 25 0 -5 1 45 0)
+                                #enableChannel: #viewDetails
+                                #model: #viewPermissions
+                                #translateLabel: true
+                              )
+                             #(#CheckBoxSpec
+                                #label: 'Owner'
+                                #name: 'CheckBox14'
+                                #layout: #(#LayoutFrame 20 0.0 50 0 170 0 70 0)
+                                #enableChannel: #viewDetails
+                                #model: #viewOwner
+                                #translateLabel: true
+                              )
+                             #(#CheckBoxSpec
+                                #label: 'Group'
+                                #name: 'CheckBox18'
+                                #layout: #(#LayoutFrame 170 0.0 50 0 -5 1 70 0)
+                                #enableChannel: #viewDetails
+                                #model: #viewGroup
+                                #translateLabel: true
+                              )
+                             #(#CheckBoxSpec
+                                #label: 'Size'
+                                #name: 'CheckBox15'
+                                #layout: #(#LayoutFrame 20 0.0 75 0 170 0 95 0)
+                                #enableChannel: #viewDetails
+                                #model: #viewSize
+                                #translateLabel: true
+                              )
+                             #(#CheckBoxSpec
+                                #label: 'Date && Time'
+                                #name: 'CheckBox19'
+                                #layout: #(#LayoutFrame 170 0.0 75 0 -5 1 95 0)
+                                #enableChannel: #viewDetails
+                                #model: #viewTime
+                                #translateLabel: true
+                              )
+                             #(#CheckBoxSpec
+                                #label: 'File Info'
+                                #name: 'CheckBox16'
+                                #layout: #(#LayoutFrame 20 0.0 100 0 170 0 120 0)
+                                #enableChannel: #viewDetails
+                                #model: #viewDescription
+                                #translateLabel: true
+                              )
+                             #(#CheckBoxSpec
+                                #label: 'Preview'
+                                #name: 'CheckBox20'
+                                #layout: #(#LayoutFrame 170 0.0 100 0 -5 1 120 0)
+                                #enableChannel: #viewDetails
+                                #model: #viewPreview
+                                #translateLabel: true
+                              )
+                             )
+                           
+                          )
+                          #extent: #(#Point 434 150)
+                        )
+                       )
+                     
+                    )
+                    #extent: #(#Point 434 530)
+                  )
+                 )
+               
+              )
+            )
+           )
+         
+        )
+      )
+! !
+
+!FileBrowserV2SettingsAppl methodsFor:'accessing'!
+
+requestor
+    "return the value of the instance variable 'requestor' (automatically generated)"
+
+    | masterApplication |
+    masterApplication := self masterApplication.
+    masterApplication notNil ifTrue:[
+        ^ masterApplication requestor.
+    ].
+    ^ nil
+! !
+
+!FileBrowserV2SettingsAppl methodsFor:'actions'!
+
+doCancel
+
+    self isPartOfSettinsDialog ifTrue:[
+        self loadRequest.
+    ].
+    self closeRequest.
+!
+
+evaluateModified
+
+    self modifiedChannel value:(self hasUnsavedChanges).
+!
+
+help
+
+    self warn:'no help available here'.
+"/    self withWaitCursorDo:[HTMLDocumentView openFullOnHelpFile:'Launcher/keyboardSetting.html'].
+!
+
+loadRequest
+    
+    | req receiver aspectList|
+
+    req := self requestor.
+    receiver := (req notNil and:[req isKindOf:AbstractFileBrowser]) ifTrue:[req] ifFalse:[currentUserPrefs].
+    aspectList := AbstractFileBrowser userPreferencesAspectList.
+    aspectList do:[ : aAspect |
+        (self perform:aAspect) value:((receiver perform:aAspect) value).
+    ].
+    self modifiedChannel value:false.
+!
+
+saveRequest
+    | result |
+
+    (self hasUnsavedChanges) ifTrue:[
+        result := self confirmWithCancel:(resources string:'Save changed FileBrowserV2 Settings ?'). 
+        result isNil ifTrue:[ ^ false].
+        result ifTrue:[
+            self saveSettings.
+        ] ifFalse:[
+            self loadRequest.
+        ]
+    ].
+    ^ true
+!
+
+saveSettings
+
+    self hasUnsavedChanges ifTrue:[
+        | req receiver aspectList|
+
+        req := self requestor.
+"/        receiver := (req notNil and:[req class isKindOf:#AbstractFileBrowser]) ifTrue:[req] ifFalse:[currentUserPrefs].
+        aspectList := AbstractFileBrowser userPreferencesAspectList.
+        aspectList do:[ : aAspect | |value|
+            value := (self perform:aAspect) value.
+            req notNil ifTrue:[
+                (req perform:aAspect) value:value.
+            ].
+            (currentUserPrefs perform:((aAspect asString, ':') asSymbol) with:value).
+        ].
+        self modifiedChannel value:false.
+    ].
+! !
+
+!FileBrowserV2SettingsAppl methodsFor:'aspects'!
+
+filenameEntryFieldVisibleHolder
+
+    filenameEntryFieldVisibleHolder isNil ifTrue:[
+        filenameEntryFieldVisibleHolder := true asValue.
+        filenameEntryFieldVisibleHolder onChangeSend:#evaluateModified to:self.
+    ].
+    ^ filenameEntryFieldVisibleHolder.
+!
+
+modifiedChannel
+
+    modifiedChannel isNil ifTrue:[
+        modifiedChannel := false asValue.
+    ].
+    ^ modifiedChannel
+!
+
+openAlwaysInTextEditor
+
+    openAlwaysInTextEditor isNil ifTrue:[
+        openAlwaysInTextEditor := true asValue.
+        openAlwaysInTextEditor onChangeSend:#evaluateModified to:self.
+    ].
+    ^ openAlwaysInTextEditor.
+!
+
+openMultipleApplicationsForType
+
+    openMultipleApplicationsForType isNil ifTrue:[
+        openMultipleApplicationsForType := true asValue.
+        openMultipleApplicationsForType onChangeSend:#evaluateModified to:self.
+    ].
+    ^ openMultipleApplicationsForType.
+!
+
+showDirectoryTree
+
+    showDirectoryTree isNil ifTrue:[
+        showDirectoryTree := true asValue.
+        showDirectoryTree onChangeSend:#evaluateModified to:self.
+    ].
+    ^ showDirectoryTree.
+!
+
+showHiddenFiles
+
+    showHiddenFiles isNil ifTrue:[
+        showHiddenFiles := true asValue.
+        showHiddenFiles onChangeSend:#evaluateModified to:self.
+    ].
+    ^ showHiddenFiles.
+!
+
+sortCaseless
+
+    sortCaseless isNil ifTrue:[
+        sortCaseless := true asValue.
+        sortCaseless onChangeSend:#evaluateModified to:self.
+    ].
+    ^ sortCaseless.
+!
+
+sortDirectoriesBeforeFiles
+
+    sortDirectoriesBeforeFiles isNil ifTrue:[
+        sortDirectoriesBeforeFiles := true asValue.
+        sortDirectoriesBeforeFiles onChangeSend:#evaluateModified to:self.
+    ].
+    ^ sortDirectoriesBeforeFiles.
+!
+
+toolBarVisibleHolder
+
+    toolBarVisibleHolder isNil ifTrue:[
+        toolBarVisibleHolder := true asValue.
+        toolBarVisibleHolder onChangeSend:#evaluateModified to:self.
+    ].
+    ^ toolBarVisibleHolder.
+!
+
+viewDescription
+
+    viewDescription isNil ifTrue:[
+        viewDescription := true asValue.
+        viewDescription onChangeSend:#evaluateModified to:self.
+    ].
+    ^ viewDescription.
+!
+
+viewDetails
+
+    viewDetails isNil ifTrue:[
+        viewDetails := true asValue.
+        viewDetails onChangeSend:#evaluateModified to:self.
+    ].
+    ^ viewDetails.
+!
+
+viewDirectoryDescription
+
+    viewDirectoryDescription isNil ifTrue:[
+        viewDirectoryDescription := true asValue.
+        viewDirectoryDescription onChangeSend:#evaluateModified to:self.
+    ].
+    ^ viewDirectoryDescription.
+!
+
+viewDirsInContentsBrowser
+
+    viewDirsInContentsBrowser isNil ifTrue:[
+        viewDirsInContentsBrowser := true asValue.
+        viewDirsInContentsBrowser onChangeSend:#evaluateModified to:self.
+    ].
+    ^ viewDirsInContentsBrowser.
+!
+
+viewFilesInDirectoryTree
+
+    viewFilesInDirectoryTree isNil ifTrue:[
+        viewFilesInDirectoryTree := true asValue.
+        viewFilesInDirectoryTree onChangeSend:#evaluateModified to:self.
+    ].
+    ^ viewFilesInDirectoryTree.
+!
+
+viewGroup
+
+    viewGroup isNil ifTrue:[
+        viewGroup := true asValue.
+        viewGroup onChangeSend:#evaluateModified to:self.
+    ].
+    ^ viewGroup.
+!
+
+viewOwner
+
+    viewOwner isNil ifTrue:[
+        viewOwner := true asValue.
+        viewOwner onChangeSend:#evaluateModified to:self.
+    ].
+    ^ viewOwner.
+!
+
+viewPermissions
+
+    viewPermissions isNil ifTrue:[
+        viewPermissions := true asValue.
+        viewPermissions onChangeSend:#evaluateModified to:self.
+    ].
+    ^ viewPermissions.
+!
+
+viewPreview
+
+    viewPreview isNil ifTrue:[
+        viewPreview := true asValue.
+        viewPreview onChangeSend:#evaluateModified to:self.
+    ].
+    ^ viewPreview.
+!
+
+viewSize
+
+    viewSize isNil ifTrue:[
+        viewSize := true asValue.
+        viewSize onChangeSend:#evaluateModified to:self.
+    ].
+    ^ viewSize.
+!
+
+viewTime
+
+    viewTime isNil ifTrue:[
+        viewTime := true asValue.
+        viewTime onChangeSend:#evaluateModified to:self.
+    ].
+    ^ viewTime.
+!
+
+viewType
+
+    viewType isNil ifTrue:[
+        viewType := true asValue.
+        viewType onChangeSend:#evaluateModified to:self.
+    ].
+    ^ viewType.
+! !
+
+!FileBrowserV2SettingsAppl methodsFor:'change & update'!
+
+update:something with:aParameter from:changedObject
+    "Invoked when an object that I depend upon sends a change notification."
+
+    "stub code automatically generated - please change as required"
+
+"/    changedObject == self allOfThem ifTrue:[
+"/        ^ self.
+"/    ].
+
+    super update:something with:aParameter from:changedObject
+! !
+
+!FileBrowserV2SettingsAppl methodsFor:'initialization & release'!
+
+initialize
+
+    resources := AbstractFileBrowser classResources.
+    currentUserPrefs := UserPreferences current.
+    super initialize
+!
+
+postBuildWith:aView
+
+    self loadRequest.
+    ^ super postBuildWith:aView
+! !
+
+!FileBrowserV2SettingsAppl methodsFor:'queries'!
+
+hasUnsavedChanges
+
+    |aspectList|
+
+    aspectList := AbstractFileBrowser userPreferencesAspectList.
+    aspectList do:[ : aAspect |
+        (self perform:aAspect) value ~= (currentUserPrefs perform:aAspect) ifTrue:[ ^ true]
+    ].
+    ^ false
+! !
+
+!FileBrowserV2SettingsAppl class methodsFor:'documentation'!
+
+version
+    ^ '$Header: /cvs/stx/stx/libtool/FileBrowserV2SettingsAppl.st,v 1.1 2002-11-26 15:52:52 penk Exp $'
+! !