initial checkin
authorpenk
Thu, 20 Feb 2003 17:27:57 +0100
changeset 4580 629ceb2e68d5
parent 4579 e37649ade348
child 4581 d61fec7a9e4f
initial checkin
FileBrowserV2SettingsDialog.st
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FileBrowserV2SettingsDialog.st	Thu Feb 20 17:27:57 2003 +0100
@@ -0,0 +1,280 @@
+"{ Package: 'stx:libtool' }"
+
+ApplicationModel subclass:#FileBrowserV2SettingsDialog
+	instanceVariableNames:'appList requestor selectionInApplList subCanvasApplicationHolder
+		help applList appIsCategory enableButtons doReload doSave
+		settingsAppl'
+	classVariableNames:'ApplicationList'
+	poolDictionaries:''
+	category:'Interface-Tools-File'
+!
+
+
+!FileBrowserV2SettingsDialog class methodsFor:'interface specs'!
+
+mainMenu
+    "This resource specification was automatically generated
+     by the MenuEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the MenuEditor may not be able to read the specification."
+
+    "
+     MenuEditor new openOnClass:FileBrowserV2SettingsFrame andSelector:#mainMenu
+     (Menu new fromLiteralArrayEncoding:(FileBrowserV2SettingsFrame mainMenu)) startUp
+    "
+
+    <resource: #menu>
+
+    ^ 
+     #(#Menu
+        #(
+         #(#MenuItem
+            #label: 'File'
+            #translateLabel: true
+            #submenu: 
+           #(#Menu
+              #(
+               #(#MenuItem
+                  #label: 'Load Settings from...'
+                  #itemValue: #loadSettingsFromFile
+                  #translateLabel: true
+                )
+               #(#MenuItem
+                  #label: 'Save Settings to...'
+                  #itemValue: #saveSettingsIntoFile
+                  #translateLabel: true
+                )
+               #(#MenuItem
+                  #label: 'Exit'
+                  #itemValue: #closeRequest
+                  #translateLabel: true
+                )
+               )
+              nil
+              nil
+            )
+          )
+         )
+        nil
+        nil
+      )
+!
+
+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:FileBrowserV2SettingsFrame andSelector:#windowSpec
+     FileBrowserV2SettingsFrame new openInterface:#windowSpec
+     FileBrowserV2SettingsFrame open
+    "
+
+    <resource: #canvas>
+
+    ^ 
+     #(#FullSpec
+        #name: #windowSpec
+        #window: 
+       #(#WindowSpec
+          #label: 'Settings Dialog'
+          #name: 'Settings Dialog'
+          #min: #(#Point 10 10)
+          #max: #(#Point 1024 768)
+          #bounds: #(#Rectangle 12 22 365 596)
+          #menu: #mainMenu
+        )
+        #component: 
+       #(#SpecCollection
+          #collection: #(
+           #(#ViewSpec
+              #name: 'Box2'
+              #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
+              #component: 
+             #(#SpecCollection
+                #collection: #(
+                 #(#SubCanvasSpec
+                    #name: 'FileBrowserV2SettingsAppl'
+                    #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -34 1)
+                    #level: 0
+                    #hasHorizontalScrollBar: false
+                    #hasVerticalScrollBar: false
+                    #majorKey: #FileBrowserV2SettingsAppl
+                    #createNewApplication: true
+                    #createNewBuilder: true
+                    #postBuildCallback: #postBuildSubCanvas:
+                  )
+                 #(#HorizontalPanelViewSpec
+                    #name: 'HorizontalPanel1'
+                    #layout: #(#LayoutFrame 0 0.0 -34 1 0 1.0 0 1)
+                    #horizontalLayout: #fitSpace
+                    #verticalLayout: #center
+                    #horizontalSpace: 3
+                    #verticalSpace: 3
+                    #component: 
+                   #(#SpecCollection
+                      #collection: #(
+                       #(#ActionButtonSpec
+                          #label: 'OK'
+                          #name: 'OK'
+                          #translateLabel: true
+                          #model: #doSave
+                          #enableChannel: #enableButtons
+                          #extent: #(#Point 84 22)
+                        )
+                       #(#ActionButtonSpec
+                          #label: 'Reload'
+                          #name: 'Reload'
+                          #translateLabel: true
+                          #model: #doReload
+                          #enableChannel: #enableButtons
+                          #extent: #(#Point 85 22)
+                        )
+                       #(#ActionButtonSpec
+                          #label: 'Cancel'
+                          #name: 'Cancel'
+                          #translateLabel: true
+                          #model: #closeRequest
+                          #extent: #(#Point 84 22)
+                        )
+                       #(#ActionButtonSpec
+                          #label: 'Help'
+                          #name: 'Help'
+                          #translateLabel: true
+                          #model: #help
+                          #enableChannel: #enableButtons
+                          #extent: #(#Point 85 22)
+                        )
+                       )
+                     
+                    )
+                  )
+                 )
+               
+              )
+            )
+           )
+         
+        )
+      )
+! !
+
+!FileBrowserV2SettingsDialog methodsFor:'accessing'!
+
+requestor
+    "return the value of the instance variable 'requestor' (automatically generated)"
+
+    ^ requestor
+!
+
+requestor:something
+    "set the value of the instance variable 'requestor' (automatically generated)"
+
+    requestor := something.
+! !
+
+!FileBrowserV2SettingsDialog methodsFor:'actions'!
+
+doReload
+
+    settingsAppl loadRequest.
+!
+
+doSave
+
+    settingsAppl saveRequest.
+    self closeRequest.
+!
+
+help
+
+    settingsAppl help
+! !
+
+!FileBrowserV2SettingsDialog methodsFor:'initialization & release'!
+
+closeRequest
+    "This is a hook method generated by the Browser.
+     It will be invoked when your app/dialog-window is about to be
+     closed (this method has a chance to suppress the close).
+     See also #closeDownViews, which is invoked when the close is really done."
+
+    settingsAppl saveRequest ifFalse:[
+        ^ self
+    ].
+    ^ super closeRequest
+!
+
+initialize
+
+    super initialize.
+!
+
+postBuildSubCanvas:aWidget
+
+    settingsAppl := aWidget client.
+    aWidget keepClientView:true. 
+! !
+
+!FileBrowserV2SettingsDialog methodsFor:'menu actions'!
+
+loadSettingsFromFile
+
+    "restore settings from a settings-file."
+
+    "a temporary kludge - we need a central systemSettings object for this,
+     which can be saved/restored with a single store/read."
+
+    |fileName|
+
+    fileName := Dialog 
+        requestFileName:(resources string:'Load Settings From:') 
+        default:'settings.stx'
+        ok:(resources string:'Load') 
+        abort:(resources string:'Cancel') 
+        pattern:'*.stx'
+        fromDirectory:nil.
+
+    (fileName size == 0) ifTrue:[
+        "/ canceled
+        ^ self
+    ].
+
+    self withWaitCursorDo:[
+        Smalltalk fileIn:fileName.
+        Transcript current topView model reOpen.
+        self doReload.
+    ].
+!
+
+saveSettingsIntoFile
+
+    |fileName resources|
+
+    resources := self class owningClass classResources.
+
+    self doReload.
+
+    fileName := Dialog 
+        requestFileName:(resources string:'Save settings in:') 
+        default:'settings.stx'
+        ok:(resources string:'Save') 
+        abort:(resources string:'Cancel') 
+        pattern:'*.stx'
+        fromDirectory:'.'.
+
+    fileName size ~~ 0 ifTrue:[
+        "not canceled"
+        FileDialog saveSettingsIn:fileName.
+    ]
+! !
+
+!FileBrowserV2SettingsDialog class methodsFor:'documentation'!
+
+version
+    ^ '$Header: /cvs/stx/stx/libtool/FileBrowserV2SettingsDialog.st,v 1.1 2003-02-20 16:27:57 penk Exp $'
+! !