--- a/ToolApplicationModel.st Fri Mar 20 21:18:57 1998 +0100
+++ b/ToolApplicationModel.st Mon Mar 23 22:41:56 1998 +0100
@@ -109,12 +109,14 @@
settings
- ^settings ? (settings := IdentityDictionary new)
+ settings isNil ifTrue: [settings := IdentityDictionary new].
+ ^settings
!
showHelp
- ^showHelp ? (showHelp := true)
+ showHelp isNil ifTrue: [showHelp := true].
+ ^showHelp
!
showHelp: aBoolean
@@ -738,11 +740,11 @@
#window:
#(#WindowSpec
#name: 'Info Bar'
- #layout: #(#LayoutFrame 431 0 352 0 930 0 697 0)
+ #layout: #(#LayoutFrame 160 0 423 0 659 0 453 0)
#label: 'Info Bar'
#min: #(#Point 400 320)
#max: #(#Point 1152 900)
- #bounds: #(#Rectangle 431 352 931 698)
+ #bounds: #(#Rectangle 160 423 660 454)
#menu: #menu
#usePreferredExtent: false
)
@@ -763,6 +765,7 @@
#labelChannel: #valueOfInfoLabel
#level: -1
#adjust: #left
+ #resizeForLabel: false
)
#(#LabelSpec
#name: 'timeLabel'
@@ -770,6 +773,7 @@
#labelChannel: #valueOfTimeLabel
#level: -1
#adjust: #right
+ #resizeForLabel: false
)
)
)
@@ -840,35 +844,50 @@
#(
#(#MenuItem
- #label: 'Label Font...'
+ #label: 'Menu...'
+ #value: #chooseFont:
+ #argument: 'Menu Font'
+ )
+ #(#MenuItem
+ #label: 'Label...'
#value: #chooseFont:
#argument: 'Label Font'
)
#(#MenuItem
- #label: 'Button Font...'
+ #label: 'Button...'
#value: #chooseFont:
#argument: 'Button Font'
)
#(#MenuItem
- #label: 'Edit Font...'
+ #label: 'Edit...'
#value: #chooseFont:
#argument: 'Edit Font'
)
#(#MenuItem
- #label: 'List Font...'
+ #label: 'List...'
#value: #chooseFont:
#argument: 'List Font'
)
#(#MenuItem
- #label: 'Tree List Font...'
+ #label: 'Tree List...'
#value: #chooseFont:
#argument: 'Tree List Font'
)
#(#MenuItem
+ #label: 'Note Book...'
+ #value: #chooseFont:
+ #argument: 'Note Book Font'
+ )
+ #(#MenuItem
+ #label: 'Framed Box...'
+ #value: #chooseFont:
+ #argument: 'Framed Box Font'
+ )
+ #(#MenuItem
#label: '-'
)
#(#MenuItem
- #label: 'Reset Fonts'
+ #label: 'Reset'
#value: #resetFonts
)
) nil
@@ -1197,23 +1216,45 @@
!ToolApplicationModel methodsFor:'settings'!
+allFontViewsDo: aBlock
+ "evaluate aBlock for all views with fonts"
+
+ |fontViews|
+
+ fontViews := OrderedCollection new.
+
+ self builder windowGroup views do: [:v| v class = MenuPanel ifTrue: [fontViews add: v]].
+
+ builder namedComponents do:
+ [:aView|
+ aView allSubViewsDo:
+ [:v|
+ v font notNil ifTrue: [fontViews add: v]
+ ]
+ ].
+ fontViews do: aBlock
+!
+
chooseFont: viewFont
"choose a font for viewFont and put it into the settings dictionary;
finally update all my views"
|defaultFont font|
- viewFont = 'Label Font' ifTrue: [defaultFont := Label defaultFont].
- viewFont = 'Button Font' ifTrue: [defaultFont := Button defaultFont].
- viewFont = 'Edit Font' ifTrue: [defaultFont := TextView defaultFont].
- viewFont = 'List Font' ifTrue: [defaultFont := ListView defaultFont].
- viewFont = 'Tree List Font' ifTrue: [defaultFont := SelectionInTreeView defaultFont].
+ viewFont = 'Menu Font' ifTrue: [defaultFont := MenuPanel defaultFont].
+ viewFont = 'Label Font' ifTrue: [defaultFont := Label defaultFont].
+ viewFont = 'Button Font' ifTrue: [defaultFont := Button defaultFont].
+ viewFont = 'Edit Font' ifTrue: [defaultFont := TextView defaultFont].
+ viewFont = 'List Font' ifTrue: [defaultFont := ListView defaultFont].
+ viewFont = 'Tree List Font' ifTrue: [defaultFont := SelectionInTreeView defaultFont].
+ viewFont = 'Note Book Font' ifTrue:[defaultFont := NoteBookView defaultFont].
+ viewFont = 'Framed Box Font' ifTrue: [defaultFont := FramedBox defaultFont].
(font := FontPanel
fontFromUserInitial: (self class settings at: viewFont asSymbol ifAbsent: nil) ? defaultFont
title: 'Choose ', viewFont) notNil
ifTrue:
- [
+ [
self class settings at: viewFont asSymbol put: (font on: device).
self updateFonts
].
@@ -1223,53 +1264,62 @@
resetFonts
"set the fonts in the settings to nil and set the views to its default font"
- (self class settings)
- removeKey: #'Label Font' ifAbsent: nil;
- removeKey: #'Button Font' ifAbsent: nil;
- removeKey: #'Edit Font' ifAbsent: nil;
- removeKey: #'List Font' ifAbsent: nil;
- removeKey: #'Tree List Font' ifAbsent: nil.
+ (self class settings)
+ removeKey: #'Menu Font' ifAbsent: nil;
+ removeKey: #'Label Font' ifAbsent: nil;
+ removeKey: #'Button Font' ifAbsent: nil;
+ removeKey: #'Edit Font' ifAbsent: nil;
+ removeKey: #'List Font' ifAbsent: nil;
+ removeKey: #'Tree List Font' ifAbsent: nil;
+ removeKey: #'Note Book Font' ifAbsent: nil;
+ removeKey: #'Framed Box Font' ifAbsent: nil.
- builder namedComponents do:
- [:aView|
- aView allSubViewsDo:
- [:aSubView|
- aSubView font: aSubView class defaultFont.
- aSubView realize
- ]
+ self allFontViewsDo:
+ [:v|
+ v font: v class defaultFont.
+ v invalidate
]
-
+
!
updateFonts
"take defined fonts from the settings and set them to the corresponding views"
- |settings labelFont buttonFont editFont listFont treeListFont|
+ |settings labelFont buttonFont menuFont editFont listFont treeListFont noteBookFont framedBoxFont updateFontsBlock|
settings := self class settings.
- labelFont := settings at: #'Label Font' ifAbsent: nil.
- buttonFont := settings at: #'Button Font' ifAbsent: nil.
- editFont := settings at: #'Edit Font' ifAbsent: nil.
- listFont := settings at: #'List Font' ifAbsent: nil.
- treeListFont := settings at: #'Tree List Font' ifAbsent: nil.
+ labelFont := settings at: #'Label Font' ifAbsent: nil.
+ buttonFont := settings at: #'Button Font' ifAbsent: nil.
+ menuFont := settings at: #'Menu Font' ifAbsent: nil.
+ editFont := settings at: #'Edit Font' ifAbsent: nil.
+ listFont := settings at: #'List Font' ifAbsent: nil.
+ treeListFont := settings at: #'Tree List Font' ifAbsent: nil.
+ noteBookFont := settings at: #'Note Book Font' ifAbsent: nil.
+ framedBoxFont := settings at: #'Framed Box Font' ifAbsent: nil.
- builder namedComponents do:
- [:aView|
- aView allSubViewsDo:
- [:aSubView|
- (labelFont notNil and: [aSubView font ~= labelFont and: [(aSubView class == Label) or: [(aSubView isKindOf: Toggle) or: [aSubView class = FramedBox or: [aSubView class == NoteBookView]]]]])
- ifTrue: [aSubView font: labelFont; fixSize; sizeChanged:nil; invalidate].
- (buttonFont notNil and: [aSubView font ~= buttonFont and: [aSubView class == Button or: [aSubView class == PopUpList]]])
- ifTrue: [aSubView label isString ifTrue: [aSubView sizeFixed: true. aSubView font: buttonFont; invalidate]].
- (editFont notNil and: [aSubView font ~= editFont and: [aSubView isKindOf: TextView]])
- ifTrue: [aSubView font: editFont; invalidate].
- (listFont notNil and: [aSubView font ~= listFont and: [aSubView class = SelectionInListView or: [aSubView class = DataSetView]]])
- ifTrue: [aSubView font: listFont. aSubView invalidate].
- (treeListFont notNil and: [aSubView font ~= treeListFont and: [aSubView isKindOf: SelectionInTreeView]])
- ifTrue: [aSubView font: treeListFont; invalidate].
- ]
- ]
+ updateFontsBlock :=
+ [:v|
+ (labelFont notNil and: [v font ~= labelFont and: [(v class == Label) or: [v isKindOf: Toggle]]])
+ ifTrue: [v font: labelFont; fixSize; sizeChanged:nil; invalidate].
+ (buttonFont notNil and: [v font ~= buttonFont and: [v class == Button or: [v class == PopUpList]]])
+ ifTrue: [v label isString ifTrue: [v sizeFixed: true. v font: buttonFont; invalidate]].
+ (menuFont notNil and: [v font ~= menuFont and: [v class == MenuPanel]])
+ ifTrue: [v font: menuFont; invalidate].
+ (editFont notNil and: [v font ~= editFont and: [v isKindOf: TextView]])
+ ifTrue: [v font: editFont; invalidate].
+ (listFont notNil and: [v font ~= listFont and: [v class = SelectionInListView or: [v class = DataSetView]]])
+ ifTrue: [v font: listFont. v invalidate].
+ (treeListFont notNil and: [v font ~= treeListFont and: [v isKindOf: SelectionInTreeView]])
+ ifTrue: [v font: treeListFont; invalidate].
+ (noteBookFont notNil and: [v font ~= noteBookFont and: [v class == NoteBookView]])
+ ifTrue: [v font: noteBookFont; invalidate].
+ (framedBoxFont notNil and: [v font ~= framedBoxFont and: [v class == FramedBox]])
+ ifTrue: [v font: framedBoxFont; invalidate]
+ ].
+
+ self allFontViewsDo: [:v| updateFontsBlock value: v]
+
! !
!ToolApplicationModel methodsFor:'startup / release'!
@@ -1339,5 +1389,5 @@
!ToolApplicationModel class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/ToolApplicationModel.st,v 1.48 1998-03-20 20:18:57 tz Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/ToolApplicationModel.st,v 1.49 1998-03-23 21:41:56 tz Exp $'
! !