AbstractLauncherApplication.st
changeset 4372 2a8886eaff5f
parent 4328 a60a893cac97
child 4379 2e224d2ccf50
equal deleted inserted replaced
4371:d7531f2aa154 4372:2a8886eaff5f
    41 	privateIn:AbstractLauncherApplication
    41 	privateIn:AbstractLauncherApplication
    42 !
    42 !
    43 
    43 
    44 ApplicationModel subclass:#SettingsDialog
    44 ApplicationModel subclass:#SettingsDialog
    45 	instanceVariableNames:'appList requestor selectionInApplList subCanvasApplicationHolder
    45 	instanceVariableNames:'appList requestor selectionInApplList subCanvasApplicationHolder
    46 		help applList appIsCategory enableButtons doReload doSave'
    46 		help applList appIsCategory doReload doSave enableReload
       
    47 		enableHelp enableOK'
    47 	classVariableNames:'ApplicationList'
    48 	classVariableNames:'ApplicationList'
    48 	poolDictionaries:''
    49 	poolDictionaries:''
    49 	privateIn:AbstractLauncherApplication
    50 	privateIn:AbstractLauncherApplication
    50 !
    51 !
    51 
    52 
  6768        #(#WindowSpec
  6769        #(#WindowSpec
  6769           #label: 'Settings Dialog'
  6770           #label: 'Settings Dialog'
  6770           #name: 'Settings Dialog'
  6771           #name: 'Settings Dialog'
  6771           #min: #(#Point 10 10)
  6772           #min: #(#Point 10 10)
  6772           #max: #(#Point 1024 768)
  6773           #max: #(#Point 1024 768)
  6773           #bounds: #(#Rectangle 16 42 816 662)
  6774           #bounds: #(#Rectangle 12 22 812 642)
  6774           #menu: #mainMenu
  6775           #menu: #mainMenu
  6775         )
  6776         )
  6776         #component: 
  6777         #component: 
  6777        #(#SpecCollection
  6778        #(#SpecCollection
  6778           #collection: #(
  6779           #collection: #(
  6814                              #(#ActionButtonSpec
  6815                              #(#ActionButtonSpec
  6815                                 #label: 'Save to Disc ...'
  6816                                 #label: 'Save to Disc ...'
  6816                                 #name: 'Button1'
  6817                                 #name: 'Button1'
  6817                                 #translateLabel: true
  6818                                 #translateLabel: true
  6818                                 #model: #saveSettings
  6819                                 #model: #saveSettings
  6819                                 #enableChannel: #enableButtons
       
  6820                                 #extent: #(#Point 128 22)
  6820                                 #extent: #(#Point 128 22)
  6821                               )
  6821                               )
  6822                              #(#ActionButtonSpec
  6822                              #(#ActionButtonSpec
  6823                                 #label: 'Load from Disc ...'
  6823                                 #label: 'Load from Disc ...'
  6824                                 #name: 'Button2'
  6824                                 #name: 'Button2'
  6825                                 #translateLabel: true
  6825                                 #translateLabel: true
  6826                                 #model: #loadSettings
  6826                                 #model: #loadSettings
  6827                                 #enableChannel: #enableButtons
       
  6828                                 #extent: #(#Point 128 22)
  6827                                 #extent: #(#Point 128 22)
  6829                               )
  6828                               )
  6830                              )
  6829                              )
  6831                            
  6830                            
  6832                           )
  6831                           )
  6862                              #(#ActionButtonSpec
  6861                              #(#ActionButtonSpec
  6863                                 #label: 'OK'
  6862                                 #label: 'OK'
  6864                                 #name: 'OK'
  6863                                 #name: 'OK'
  6865                                 #translateLabel: true
  6864                                 #translateLabel: true
  6866                                 #model: #doSave
  6865                                 #model: #doSave
  6867                                 #enableChannel: #enableButtons
  6866                                 #enableChannel: #enableOK
  6868                                 #extent: #(#Point 127 22)
  6867                                 #extent: #(#Point 127 22)
  6869                               )
  6868                               )
  6870                              #(#ActionButtonSpec
  6869                              #(#ActionButtonSpec
  6871                                 #label: 'Reload'
  6870                                 #label: 'Discard'
  6872                                 #name: 'Reload'
  6871                                 #name: 'Reload'
  6873                                 #translateLabel: true
  6872                                 #translateLabel: true
  6874                                 #model: #doReload
  6873                                 #model: #doReload
  6875                                 #enableChannel: #enableButtons
  6874                                 #enableChannel: #enableReload
  6876                                 #extent: #(#Point 128 22)
  6875                                 #extent: #(#Point 128 22)
  6877                               )
  6876                               )
  6878                              #(#ActionButtonSpec
  6877                              #(#ActionButtonSpec
  6879                                 #label: 'Cancel'
  6878                                 #label: 'Close'
  6880                                 #name: 'Cancel'
  6879                                 #name: 'Close'
  6881                                 #translateLabel: true
  6880                                 #translateLabel: true
  6882                                 #model: #closeRequest
  6881                                 #model: #closeRequest
  6883                                 #extent: #(#Point 127 22)
  6882                                 #extent: #(#Point 127 22)
  6884                               )
  6883                               )
  6885                              #(#ActionButtonSpec
  6884                              #(#ActionButtonSpec
  6886                                 #label: 'Help'
  6885                                 #label: 'Help'
  6887                                 #name: 'Help'
  6886                                 #name: 'Help'
  6888                                 #translateLabel: true
  6887                                 #translateLabel: true
  6889                                 #model: #help
  6888                                 #model: #help
  6890                                 #enableChannel: #enableButtons
  6889                                 #enableChannel: #enableHelp
  6891                                 #extent: #(#Point 128 22)
  6890                                 #extent: #(#Point 128 22)
  6892                               )
  6891                               )
  6893                              )
  6892                              )
  6894                            
  6893                            
  6895                           )
  6894                           )
  7005 doSave
  7004 doSave
  7006     | item |
  7005     | item |
  7007 
  7006 
  7008     item := self selectionInApplList value.
  7007     item := self selectionInApplList value.
  7009     (item isNil or:[item isCategory or:[item application isNil]]) ifTrue:[ ^ self].
  7008     (item isNil or:[item isCategory or:[item application isNil]]) ifTrue:[ ^ self].
  7010     item application saveRequest.
  7009     item application saveSettings.
  7011 !
  7010 !
  7012 
  7011 
  7013 help
  7012 help
  7014 
  7013 
  7015     | item |
  7014     | item |
  7057         applList := AbstractLauncherApplication::HierarchicalSettingsApplList new.
  7056         applList := AbstractLauncherApplication::HierarchicalSettingsApplList new.
  7058     ].
  7057     ].
  7059     ^ applList.
  7058     ^ applList.
  7060 !
  7059 !
  7061 
  7060 
  7062 enableButtons
  7061 enableHelp
  7063 
  7062     "automatically generated by UIPainter ..."
  7064     enableButtons isNil ifTrue:[
  7063 
  7065         enableButtons := true asValue.
  7064     "*** the code below creates a default model when invoked."
  7066     ].
  7065     "*** (which may not be the one you wanted)"
  7067     ^ enableButtons.
  7066     "*** Please change as required and accept it in the browser."
       
  7067     "*** (and replace this comment by something more useful ;-)"
       
  7068 
       
  7069     enableHelp isNil ifTrue:[
       
  7070         enableHelp := true asValue.
       
  7071 "/ if your app needs to be notified of changes, uncomment one of the lines below:
       
  7072 "/       enableHelp addDependent:self.
       
  7073 "/       enableHelp onChangeSend:#enableHelpChanged to:self.
       
  7074     ].
       
  7075     ^ enableHelp.
       
  7076 !
       
  7077 
       
  7078 enableOK
       
  7079     "automatically generated by UIPainter ..."
       
  7080 
       
  7081     "*** the code below creates a default model when invoked."
       
  7082     "*** (which may not be the one you wanted)"
       
  7083     "*** Please change as required and accept it in the browser."
       
  7084     "*** (and replace this comment by something more useful ;-)"
       
  7085 
       
  7086     enableOK isNil ifTrue:[
       
  7087         enableOK := true asValue.
       
  7088 "/ if your app needs to be notified of changes, uncomment one of the lines below:
       
  7089 "/       enableOK addDependent:self.
       
  7090 "/       enableOK onChangeSend:#enableOKChanged to:self.
       
  7091     ].
       
  7092     ^ enableOK.
       
  7093 !
       
  7094 
       
  7095 enableReload
       
  7096     "automatically generated by UIPainter ..."
       
  7097 
       
  7098     "*** the code below creates a default model when invoked."
       
  7099     "*** (which may not be the one you wanted)"
       
  7100     "*** Please change as required and accept it in the browser."
       
  7101     "*** (and replace this comment by something more useful ;-)"
       
  7102 
       
  7103     enableReload isNil ifTrue:[
       
  7104         enableReload := true asValue.
       
  7105 "/ if your app needs to be notified of changes, uncomment one of the lines below:
       
  7106 "/       enableReload addDependent:self.
       
  7107 "/       enableReload onChangeSend:#enableReloadChanged to:self.
       
  7108     ].
       
  7109     ^ enableReload.
  7068 !
  7110 !
  7069 
  7111 
  7070 selectionInApplList
  7112 selectionInApplList
  7071 
  7113 
  7072     selectionInApplList isNil ifTrue:[
  7114     selectionInApplList isNil ifTrue:[
  7089     ^ subCanvasApplicationHolder.
  7131     ^ subCanvasApplicationHolder.
  7090 ! !
  7132 ! !
  7091 
  7133 
  7092 !AbstractLauncherApplication::SettingsDialog methodsFor:'change & update'!
  7134 !AbstractLauncherApplication::SettingsDialog methodsFor:'change & update'!
  7093 
  7135 
       
  7136 modifiedChanged
       
  7137 
       
  7138     |changedObject|
       
  7139 
       
  7140     changedObject := self subCanvasApplicationHolder value modifiedChannel.
       
  7141     self enableOK value:(changedObject value).
       
  7142     self enableReload value:(changedObject value).
       
  7143 !
       
  7144 
  7094 selectionChanged
  7145 selectionChanged
  7095 
  7146 
  7096     | item isCat oldAppl|
  7147     | item isCat oldAppl|
  7097 
  7148 
  7098     oldAppl := self subCanvasApplicationHolder value.
  7149     oldAppl := self subCanvasApplicationHolder value.
  7099     oldAppl notNil ifTrue:[
  7150     oldAppl notNil ifTrue:[
  7100         oldAppl saveRequest.
  7151         oldAppl saveRequest.
       
  7152         oldAppl modifiedChannel removeDependent:self.
  7101     ].
  7153     ].
  7102     item := self selectionInApplList value.
  7154     item := self selectionInApplList value.
  7103     isCat := item isCategory.
  7155     isCat := item isCategory.
  7104     self enableButtons value:(isCat not).
  7156     self enableOK value:(isCat not).
       
  7157     self enableReload value:(isCat not).
       
  7158     self enableHelp value:(isCat not).
  7105     isCat ifTrue:[
  7159     isCat ifTrue:[
  7106         self subCanvasApplicationHolder value:nil.
  7160         self subCanvasApplicationHolder value:nil.
  7107         ^ self
  7161         ^ self
  7108     ].
  7162     ].
  7109     item application isNil ifTrue:[
  7163     item application isNil ifTrue:[
  7110         item application:(item applClass new).
  7164         item application:(item applClass new).
  7111     ].
  7165 
       
  7166     ].
       
  7167     item application modifiedChannel addDependent:self.
  7112     self subCanvasApplicationHolder value:item application.
  7168     self subCanvasApplicationHolder value:item application.
       
  7169     self modifiedChanged.
  7113 !
  7170 !
  7114 
  7171 
  7115 update:something with:aParameter from:changedObject
  7172 update:something with:aParameter from:changedObject
  7116     "Invoked when an object that I depend upon sends a change notification."
  7173     "Invoked when an object that I depend upon sends a change notification."
  7117 
  7174 
  7119 
  7176 
  7120     changedObject == self selectionInApplList ifTrue:[
  7177     changedObject == self selectionInApplList ifTrue:[
  7121         self selectionChanged.
  7178         self selectionChanged.
  7122         ^ self
  7179         ^ self
  7123     ].
  7180     ].
       
  7181     changedObject == self subCanvasApplicationHolder value modifiedChannel ifTrue:[
       
  7182         self modifiedChanged.
       
  7183         ^ self
       
  7184     ].
       
  7185 
  7124     super update:something with:aParameter from:changedObject
  7186     super update:something with:aParameter from:changedObject
  7125 ! !
  7187 ! !
  7126 
  7188 
  7127 !AbstractLauncherApplication::SettingsDialog methodsFor:'initialization & release'!
  7189 !AbstractLauncherApplication::SettingsDialog methodsFor:'initialization & release'!
  7128 
  7190 
  7547 ! !
  7609 ! !
  7548 
  7610 
  7549 !AbstractLauncherApplication class methodsFor:'documentation'!
  7611 !AbstractLauncherApplication class methodsFor:'documentation'!
  7550 
  7612 
  7551 version
  7613 version
  7552     ^ '$Header: /cvs/stx/stx/libtool/AbstractLauncherApplication.st,v 1.239 2002-11-27 10:02:33 penk Exp $'
  7614     ^ '$Header: /cvs/stx/stx/libtool/AbstractLauncherApplication.st,v 1.240 2002-12-12 13:01:10 penk Exp $'
  7553 ! !
  7615 ! !
  7554 
  7616 
  7555 AbstractLauncherApplication::SettingsDialog initialize!
  7617 AbstractLauncherApplication::SettingsDialog initialize!