1195 ^window minExtent max: (preferredExtentOfWindow min: window maxExtent) |
1214 ^window minExtent max: (preferredExtentOfWindow min: window maxExtent) |
1196 ! ! |
1215 ! ! |
1197 |
1216 |
1198 !ToolApplicationModel methodsFor:'settings'! |
1217 !ToolApplicationModel methodsFor:'settings'! |
1199 |
1218 |
|
1219 allFontViewsDo: aBlock |
|
1220 "evaluate aBlock for all views with fonts" |
|
1221 |
|
1222 |fontViews| |
|
1223 |
|
1224 fontViews := OrderedCollection new. |
|
1225 |
|
1226 self builder windowGroup views do: [:v| v class = MenuPanel ifTrue: [fontViews add: v]]. |
|
1227 |
|
1228 builder namedComponents do: |
|
1229 [:aView| |
|
1230 aView allSubViewsDo: |
|
1231 [:v| |
|
1232 v font notNil ifTrue: [fontViews add: v] |
|
1233 ] |
|
1234 ]. |
|
1235 fontViews do: aBlock |
|
1236 ! |
|
1237 |
1200 chooseFont: viewFont |
1238 chooseFont: viewFont |
1201 "choose a font for viewFont and put it into the settings dictionary; |
1239 "choose a font for viewFont and put it into the settings dictionary; |
1202 finally update all my views" |
1240 finally update all my views" |
1203 |
1241 |
1204 |defaultFont font| |
1242 |defaultFont font| |
1205 |
1243 |
1206 viewFont = 'Label Font' ifTrue: [defaultFont := Label defaultFont]. |
1244 viewFont = 'Menu Font' ifTrue: [defaultFont := MenuPanel defaultFont]. |
1207 viewFont = 'Button Font' ifTrue: [defaultFont := Button defaultFont]. |
1245 viewFont = 'Label Font' ifTrue: [defaultFont := Label defaultFont]. |
1208 viewFont = 'Edit Font' ifTrue: [defaultFont := TextView defaultFont]. |
1246 viewFont = 'Button Font' ifTrue: [defaultFont := Button defaultFont]. |
1209 viewFont = 'List Font' ifTrue: [defaultFont := ListView defaultFont]. |
1247 viewFont = 'Edit Font' ifTrue: [defaultFont := TextView defaultFont]. |
1210 viewFont = 'Tree List Font' ifTrue: [defaultFont := SelectionInTreeView defaultFont]. |
1248 viewFont = 'List Font' ifTrue: [defaultFont := ListView defaultFont]. |
|
1249 viewFont = 'Tree List Font' ifTrue: [defaultFont := SelectionInTreeView defaultFont]. |
|
1250 viewFont = 'Note Book Font' ifTrue:[defaultFont := NoteBookView defaultFont]. |
|
1251 viewFont = 'Framed Box Font' ifTrue: [defaultFont := FramedBox defaultFont]. |
1211 |
1252 |
1212 (font := FontPanel |
1253 (font := FontPanel |
1213 fontFromUserInitial: (self class settings at: viewFont asSymbol ifAbsent: nil) ? defaultFont |
1254 fontFromUserInitial: (self class settings at: viewFont asSymbol ifAbsent: nil) ? defaultFont |
1214 title: 'Choose ', viewFont) notNil |
1255 title: 'Choose ', viewFont) notNil |
1215 ifTrue: |
1256 ifTrue: |
1216 [ |
1257 [ |
1217 self class settings at: viewFont asSymbol put: (font on: device). |
1258 self class settings at: viewFont asSymbol put: (font on: device). |
1218 self updateFonts |
1259 self updateFonts |
1219 ]. |
1260 ]. |
1220 ^font |
1261 ^font |
1221 ! |
1262 ! |
1222 |
1263 |
1223 resetFonts |
1264 resetFonts |
1224 "set the fonts in the settings to nil and set the views to its default font" |
1265 "set the fonts in the settings to nil and set the views to its default font" |
1225 |
1266 |
1226 (self class settings) |
1267 (self class settings) |
1227 removeKey: #'Label Font' ifAbsent: nil; |
1268 removeKey: #'Menu Font' ifAbsent: nil; |
1228 removeKey: #'Button Font' ifAbsent: nil; |
1269 removeKey: #'Label Font' ifAbsent: nil; |
1229 removeKey: #'Edit Font' ifAbsent: nil; |
1270 removeKey: #'Button Font' ifAbsent: nil; |
1230 removeKey: #'List Font' ifAbsent: nil; |
1271 removeKey: #'Edit Font' ifAbsent: nil; |
1231 removeKey: #'Tree List Font' ifAbsent: nil. |
1272 removeKey: #'List Font' ifAbsent: nil; |
1232 |
1273 removeKey: #'Tree List Font' ifAbsent: nil; |
1233 builder namedComponents do: |
1274 removeKey: #'Note Book Font' ifAbsent: nil; |
1234 [:aView| |
1275 removeKey: #'Framed Box Font' ifAbsent: nil. |
1235 aView allSubViewsDo: |
1276 |
1236 [:aSubView| |
1277 self allFontViewsDo: |
1237 aSubView font: aSubView class defaultFont. |
1278 [:v| |
1238 aSubView realize |
1279 v font: v class defaultFont. |
1239 ] |
1280 v invalidate |
1240 ] |
1281 ] |
1241 |
1282 |
1242 ! |
1283 ! |
1243 |
1284 |
1244 updateFonts |
1285 updateFonts |
1245 "take defined fonts from the settings and set them to the corresponding views" |
1286 "take defined fonts from the settings and set them to the corresponding views" |
1246 |
1287 |
1247 |settings labelFont buttonFont editFont listFont treeListFont| |
1288 |settings labelFont buttonFont menuFont editFont listFont treeListFont noteBookFont framedBoxFont updateFontsBlock| |
1248 |
1289 |
1249 settings := self class settings. |
1290 settings := self class settings. |
1250 |
1291 |
1251 labelFont := settings at: #'Label Font' ifAbsent: nil. |
1292 labelFont := settings at: #'Label Font' ifAbsent: nil. |
1252 buttonFont := settings at: #'Button Font' ifAbsent: nil. |
1293 buttonFont := settings at: #'Button Font' ifAbsent: nil. |
1253 editFont := settings at: #'Edit Font' ifAbsent: nil. |
1294 menuFont := settings at: #'Menu Font' ifAbsent: nil. |
1254 listFont := settings at: #'List Font' ifAbsent: nil. |
1295 editFont := settings at: #'Edit Font' ifAbsent: nil. |
1255 treeListFont := settings at: #'Tree List Font' ifAbsent: nil. |
1296 listFont := settings at: #'List Font' ifAbsent: nil. |
1256 |
1297 treeListFont := settings at: #'Tree List Font' ifAbsent: nil. |
1257 builder namedComponents do: |
1298 noteBookFont := settings at: #'Note Book Font' ifAbsent: nil. |
1258 [:aView| |
1299 framedBoxFont := settings at: #'Framed Box Font' ifAbsent: nil. |
1259 aView allSubViewsDo: |
1300 |
1260 [:aSubView| |
1301 updateFontsBlock := |
1261 (labelFont notNil and: [aSubView font ~= labelFont and: [(aSubView class == Label) or: [(aSubView isKindOf: Toggle) or: [aSubView class = FramedBox or: [aSubView class == NoteBookView]]]]]) |
1302 [:v| |
1262 ifTrue: [aSubView font: labelFont; fixSize; sizeChanged:nil; invalidate]. |
1303 (labelFont notNil and: [v font ~= labelFont and: [(v class == Label) or: [v isKindOf: Toggle]]]) |
1263 (buttonFont notNil and: [aSubView font ~= buttonFont and: [aSubView class == Button or: [aSubView class == PopUpList]]]) |
1304 ifTrue: [v font: labelFont; fixSize; sizeChanged:nil; invalidate]. |
1264 ifTrue: [aSubView label isString ifTrue: [aSubView sizeFixed: true. aSubView font: buttonFont; invalidate]]. |
1305 (buttonFont notNil and: [v font ~= buttonFont and: [v class == Button or: [v class == PopUpList]]]) |
1265 (editFont notNil and: [aSubView font ~= editFont and: [aSubView isKindOf: TextView]]) |
1306 ifTrue: [v label isString ifTrue: [v sizeFixed: true. v font: buttonFont; invalidate]]. |
1266 ifTrue: [aSubView font: editFont; invalidate]. |
1307 (menuFont notNil and: [v font ~= menuFont and: [v class == MenuPanel]]) |
1267 (listFont notNil and: [aSubView font ~= listFont and: [aSubView class = SelectionInListView or: [aSubView class = DataSetView]]]) |
1308 ifTrue: [v font: menuFont; invalidate]. |
1268 ifTrue: [aSubView font: listFont. aSubView invalidate]. |
1309 (editFont notNil and: [v font ~= editFont and: [v isKindOf: TextView]]) |
1269 (treeListFont notNil and: [aSubView font ~= treeListFont and: [aSubView isKindOf: SelectionInTreeView]]) |
1310 ifTrue: [v font: editFont; invalidate]. |
1270 ifTrue: [aSubView font: treeListFont; invalidate]. |
1311 (listFont notNil and: [v font ~= listFont and: [v class = SelectionInListView or: [v class = DataSetView]]]) |
1271 ] |
1312 ifTrue: [v font: listFont. v invalidate]. |
1272 ] |
1313 (treeListFont notNil and: [v font ~= treeListFont and: [v isKindOf: SelectionInTreeView]]) |
|
1314 ifTrue: [v font: treeListFont; invalidate]. |
|
1315 (noteBookFont notNil and: [v font ~= noteBookFont and: [v class == NoteBookView]]) |
|
1316 ifTrue: [v font: noteBookFont; invalidate]. |
|
1317 (framedBoxFont notNil and: [v font ~= framedBoxFont and: [v class == FramedBox]]) |
|
1318 ifTrue: [v font: framedBoxFont; invalidate] |
|
1319 ]. |
|
1320 |
|
1321 self allFontViewsDo: [:v| updateFontsBlock value: v] |
|
1322 |
1273 ! ! |
1323 ! ! |
1274 |
1324 |
1275 !ToolApplicationModel methodsFor:'startup / release'! |
1325 !ToolApplicationModel methodsFor:'startup / release'! |
1276 |
1326 |
1277 allButOpenInterface:aSymbol |
1327 allButOpenInterface:aSymbol |