# HG changeset patch # User Claus Gittinger # Date 1397409817 -7200 # Node ID 733f2b55db735bbdaddec94a01bdb7d93808977e # Parent bee53f8e01ca1ff5febb91ef6d2c2143d48f375a initial checkin diff -r bee53f8e01ca -r 733f2b55db73 Tools__FontSettingsApplication.st --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Tools__FontSettingsApplication.st Sun Apr 13 19:23:37 2014 +0200 @@ -0,0 +1,1215 @@ +"{ Package: 'stx:libtool' }" + +AbstractSettingsApplication subclass:#FontSettingsApplication + instanceVariableNames:'filter allOfThem labelDef buttonDef listDef menuDef textDef + othersDef allFontLabelHolder buttonsFontLabelHolder + textFontLabelHolder labelsFontLabelHolder listsFontLabelHolder + menusFontLabelHolder otherFontLabelHolder allLabel buttonsLabel + textLabel labelLabel listsLabel menuLabel inputFieldLabel + inputFieldDef inputFieldFontLabelHolder otherLabel + linuxFontWorkaround otherDef' + classVariableNames:'' + poolDictionaries:'' + category:'Interface-Smalltalk' +! + + +!FontSettingsApplication class methodsFor:'instance creation'! + +fontForEncoding:encodingMatch + + | inst | + + inst := self new. + inst encodingMatch:encodingMatch. + self initialize. + self open. +! ! + +!FontSettingsApplication class methodsFor:'defaults'! + +widgetList + + ^ #( + 'All' + 'Labels' + 'Buttons' + 'Lists' + 'Menus' + 'Edited Text' + 'Others' + ) +! ! + +!FontSettingsApplication class methodsFor:'help specs'! + +flyByHelpSpec + "This resource specification was automatically generated + by the UIHelpTool of ST/X." + + "Do not manually edit this!! If it is corrupted, + the UIHelpTool may not be able to read the specification." + + " + UIHelpTool openOnClass:FontSettingsAppl + " + + + + ^ super flyByHelpSpec addPairsFrom:#( + +#resetToDefault +'Reset fonts back to original default values (as specified in the window style-file and OS settings)' + +#changeToHighContrast +'Change settings for higher contrast.\Useful for presentations and outdor operation' + +#changeToBigFonts +'Change settings for bigger fonts.\Useful for presentations' + +#changeToHugeFonts +'Change settings for huge fonts.\Useful for presentations' + +#changeToSTXLook +'Change settings for an ST/X-like look with fixed-width code fonts' + +#changeToSTXLookXft +'Change settings for an ST/X-like look with fixed-width code fonts).\Uses better looking Xft fonts if avaiable (XWindow only)' + +#changeToSqueakLook +'Change settings for a Squeak-like look with variable code fonts' + +#changeToVisualAgeLook +'Change settings for a VisualAge-like look with bold variable code fonts' +) + + "Created: / 17-03-2012 / 11:37:51 / cg" +! ! + +!FontSettingsApplication class methodsFor:'image specs'! + +defaultIcon + + + ^ ToolbarIconLibrary fontIcon +! + +defaultIcon2 + "This resource specification was automatically generated + by the ImageEditor of ST/X." + + "Do not manually edit this!! If it is corrupted, + the ImageEditor may not be able to read the specification." + + " + self defaultIcon2 inspect + ImageEditor openOnClass:self andSelector:#defaultIcon2 + Icon flushCachedIcons + " + + + + ^Icon + constantNamed:#'FontSettingsAppl class defaultIcon2' + ifAbsentPut:[(Depth4Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' +@@@@@@@@@@@@@@@@@@@@@!!X @@@@@@@!!X @@@6H@@@@@@DP6H@@@Y!!H@@@@@QDY"@@@BY"@@@@ADQBY"@@@FX @@@@@DQCX @@@6H@@@@@QEP6H@@@@ @@@@ +ADUDP @C@@@@@@@DQSH@@@L @@@@@@QEL @@@2@@@@@@ADT2@@@CH@@@@@@DQSH@@@L @@@@@@QEL @@@2@@@@@@QDT2@@@CH@@@@@QDQSH@@@@ @@@@@DQE +P @@@@@@@@@@@DQ@@@@@@@@@@@@@@D@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255 150 150 150 213 213 213 215 48 48 134 54 54 240 240 240]; mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@G @OG0@O''<@O7>@O? A?? A??@A@A<>@A<>@A=>@C?>@G<>@C<\@@8D@@H@@@@@@@@@@@@@@') ; yourself); yourself] +! ! + +!FontSettingsApplication 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:FontSettingsAppl andSelector:#windowSpec + FontSettingsAppl new openInterface:#windowSpec + FontSettingsAppl open + " + + + + ^ + #(FullSpec + name: windowSpec + window: + (WindowSpec + label: 'Font Settings' + name: 'Font Settings' + min: (Point 10 10) + bounds: (Rectangle 0 0 641 753) + ) + component: + (SpecCollection + collection: ( + (VerticalPanelViewSpec + name: 'VerticalPanel1' + layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) + horizontalLayout: fitSpace + verticalLayout: topSpace + horizontalSpace: 3 + verticalSpace: 3 + component: + (SpecCollection + collection: ( + (TextEditorSpec + name: 'TextEditor1' + style: labelFont + model: infoText + hasHorizontalScrollBar: true + hasVerticalScrollBar: true + miniScrollerHorizontal: true + miniScrollerVertical: true + isReadOnly: true + hasKeyboardFocusInitially: false + extent: (Point 635 132) + viewClassName: 'ListView' + ) + (ViewSpec + name: 'CodeBox' + component: + (SpecCollection + collection: ( + (LabelSpec + label: 'Code' + name: 'Label1' + layout: (LayoutFrame 0 0.0 0 0 0 1.0 20 0) + translateLabel: true + adjust: left + ) + (LabelSpec + label: 'Text Font' + name: 'Label2' + layout: (LayoutFrame 110 0 22 0 -5 1 44 0) + translateLabel: true + labelChannel: textFontLabelHolder + adjust: left + postBuildCallback: postBuildTextFontLabel: + ) + (ActionButtonSpec + label: 'Change...' + name: 'Button1' + layout: (LayoutFrame 0 0.0 22 0 105 0 44 0) + translateLabel: true + tabable: true + model: changeTextFont + ) + (DividerSpec + name: 'Separator11' + layout: (LayoutFrame 0 0.0 -3 1 0 1.0 0 1) + ) + ) + + ) + extent: (Point 635 50) + ) + (ViewSpec + name: 'InputFieldsBox' + component: + (SpecCollection + collection: ( + (LabelSpec + label: 'Input Fields' + name: 'Input Fields' + layout: (LayoutFrame 0 0.0 0 0 0 1.0 20 0) + translateLabel: true + adjust: left + ) + (LabelSpec + label: 'InputFields Font' + name: 'InputFieldsFont' + layout: (LayoutFrame 110 0 22 0 -5 1 44 0) + translateLabel: true + labelChannel: inputFieldFontLabelHolder + adjust: left + postBuildCallback: postBuildInputFieldFontLabel: + ) + (ActionButtonSpec + label: 'Change...' + name: 'ChangeText' + layout: (LayoutFrame 0 0.0 22 0 105 0 44 0) + translateLabel: true + tabable: true + model: changeInputFieldFont + ) + (DividerSpec + name: 'Separator10' + layout: (LayoutFrame 0 0.0 -3 1 0 1.0 0 1) + ) + ) + + ) + extent: (Point 635 50) + ) + (ViewSpec + name: 'ListsBox' + component: + (SpecCollection + collection: ( + (LabelSpec + label: 'Lists' + name: 'Lists' + layout: (LayoutFrame 0 0.0 0 0 0 1.0 20 0) + translateLabel: true + adjust: left + ) + (LabelSpec + label: 'Lists Font' + name: 'ListsFont' + layout: (LayoutFrame 110 0 22 0 -5 1 44 0) + translateLabel: true + labelChannel: listsFontLabelHolder + adjust: left + postBuildCallback: postBuildListsFontLabel: + ) + (ActionButtonSpec + label: 'Change...' + name: 'ChangeLists' + layout: (LayoutFrame 0 0.0 22 0 105 0 44 0) + translateLabel: true + tabable: true + model: changeListsFont + ) + (DividerSpec + name: 'Separator8' + layout: (LayoutFrame 0 0.0 -3 1 0 1.0 0 1) + ) + ) + + ) + extent: (Point 635 50) + ) + (ViewSpec + name: 'MenusBox' + component: + (SpecCollection + collection: ( + (LabelSpec + label: 'Menus' + name: 'Menus' + layout: (LayoutFrame 0 0.0 0 0 0 1.0 20 0) + translateLabel: true + adjust: left + ) + (LabelSpec + label: 'Menus Font' + name: 'MenusFont' + layout: (LayoutFrame 110 0 22 0 -5 1 44 0) + translateLabel: true + labelChannel: menusFontLabelHolder + adjust: left + postBuildCallback: postBuildMenuesFontLabel: + ) + (ActionButtonSpec + label: 'Change...' + name: 'ChangeMenus' + layout: (LayoutFrame 0 0.0 22 0 105 0 44 0) + translateLabel: true + tabable: true + model: changeMenusFont + ) + (DividerSpec + name: 'Separator9' + layout: (LayoutFrame 0 0.0 -3 1 0 1.0 0 1) + ) + ) + + ) + extent: (Point 635 50) + ) + (ViewSpec + name: 'LabelsBox' + component: + (SpecCollection + collection: ( + (LabelSpec + label: 'Labels' + name: 'Labels' + layout: (LayoutFrame 0 0.0 0 0 0 1.0 20 0) + translateLabel: true + adjust: left + ) + (LabelSpec + label: 'Labels' + name: 'LabelsFont' + layout: (LayoutFrame 110 0 22 0 -5 1 44 0) + translateLabel: true + labelChannel: labelsFontLabelHolder + adjust: left + postBuildCallback: postBuildLabelsFontLabel: + ) + (ActionButtonSpec + label: 'Change...' + name: 'ChangeLabels' + layout: (LayoutFrame 0 0.0 22 0 105 0 44 0) + translateLabel: true + tabable: true + model: changeLabelsFont + ) + (DividerSpec + name: 'Separator6' + layout: (LayoutFrame 0 0.0 -3 1 0 1.0 0 1) + ) + ) + + ) + extent: (Point 635 50) + ) + (ViewSpec + name: 'ButtonsBox' + component: + (SpecCollection + collection: ( + (LabelSpec + label: 'Buttons' + name: 'Buttons' + layout: (LayoutFrame 0 0.0 0 0 0 1.0 20 0) + translateLabel: true + adjust: left + ) + (LabelSpec + label: 'Buttons Font' + name: 'ButtonsFont' + layout: (LayoutFrame 110 0 22 0 -5 1 44 0) + translateLabel: true + labelChannel: buttonsFontLabelHolder + adjust: left + postBuildCallback: postBuildButtonsFontLabel: + ) + (ActionButtonSpec + label: 'Change...' + name: 'Change Buttons' + layout: (LayoutFrame 0 0.0 22 0 105 0 44 0) + translateLabel: true + tabable: true + model: changeButtonsFont + ) + (DividerSpec + name: 'Separator7' + layout: (LayoutFrame 0 0.0 -3 1 0 1.0 0 1) + ) + ) + + ) + extent: (Point 635 50) + ) + (ViewSpec + name: 'OtherBox' + component: + (SpecCollection + collection: ( + (LabelSpec + label: 'All Others' + name: 'Label5' + layout: (LayoutFrame 0 0.0 0 0 0 1.0 20 0) + translateLabel: true + adjust: left + ) + (LabelSpec + label: 'Label' + name: 'Label6' + layout: (LayoutFrame 110 0 22 0 -5 1 44 0) + translateLabel: true + labelChannel: otherFontLabelHolder + adjust: left + postBuildCallback: postBuildOtherFontLabel: + ) + (ActionButtonSpec + label: 'Change...' + name: 'Button9' + layout: (LayoutFrame 0 0.0 22 0 105 0 44 0) + translateLabel: true + tabable: true + model: changeOtherFont + ) + (DividerSpec + name: 'Separator13' + layout: (LayoutFrame 0 0.0 -3 1 0 1.0 0 1) + ) + ) + + ) + extent: (Point 635 50) + ) + (ViewSpec + name: 'AllBox' + component: + (SpecCollection + collection: ( + (LabelSpec + label: 'All' + name: 'All' + layout: (LayoutFrame 0 0.0 0 0 0 1.0 20 0) + translateLabel: true + adjust: left + ) + (ActionButtonSpec + label: 'Change...' + name: 'ChangeAll' + layout: (LayoutFrame 0 0.0 22 0 105 0 44 0) + translateLabel: true + tabable: true + model: changeAllFont + ) + (DividerSpec + name: 'Separator1' + layout: (LayoutFrame 0 0.0 -3 1 0 1.0 0 1) + ) + ) + + ) + extent: (Point 635 50) + ) + (CheckBoxSpec + label: 'Linux font workaround: do not reset fonts on snapshot restart' + name: 'LinuxFontWorkaroundBox' + visibilityChannel: linuxFontWorkaroundVisible + model: linuxFontWorkaround + translateLabel: true + extent: (Point 635 30) + ) + (DividerSpec + name: 'Separator12' + visibilityChannel: linuxFontWorkaroundVisible + extent: (Point 635 3) + ) + (ViewSpec + name: 'SpecialsBox' + component: + (SpecCollection + collection: ( + (LabelSpec + label: 'Common Settings:' + name: 'Label4' + layout: (LayoutFrame 0 0.0 11 0 0 1.0 33 0) + translateLabel: true + adjust: left + ) + (ActionButtonSpec + label: 'Default' + name: 'Button2' + layout: (LayoutFrame 0 0.0 35 0 130 0 57 0) + activeHelpKey: resetToDefault + translateLabel: true + tabable: true + model: changeToDefault + ) + (ActionButtonSpec + label: 'High Contrast' + name: 'Button3' + layout: (LayoutFrame 148 0.0 35 0 298 0 57 0) + activeHelpKey: changeToHighContrast + translateLabel: true + tabable: true + model: changeToHighContrast + ) + (ActionButtonSpec + label: 'Big Fonts' + name: 'Button4' + layout: (LayoutFrame 309 0.0 35 0 459 0 57 0) + activeHelpKey: changeToBigFonts + translateLabel: true + tabable: true + model: changeToBigFonts + ) + (ActionButtonSpec + label: 'Huge Fonts' + name: 'Button5' + layout: (LayoutFrame 470 0.0 35 0 620 0 57 0) + activeHelpKey: changeToHugeFonts + translateLabel: true + tabable: true + model: changeToHugeFonts + ) + (ActionButtonSpec + label: 'ST/X Look' + name: 'Button8' + layout: (LayoutFrame 148 0.0 67 0 298 0 89 0) + activeHelpKey: changeToSTXLook + translateLabel: true + tabable: true + model: changeToSTXLook + ) + (ActionButtonSpec + label: 'Squeak Look' + name: 'Button6' + layout: (LayoutFrame 309 0.0 67 0 459 0 89 0) + activeHelpKey: changeToSqueakLook + translateLabel: true + tabable: true + model: changeToSqueakLook + ) + (ActionButtonSpec + label: 'V''Age Look' + name: 'Button7' + layout: (LayoutFrame 470 0.0 67 0 620 0 89 0) + activeHelpKey: changeToVisualAgeLook + translateLabel: true + tabable: true + model: changeToVisualAgeLook + ) + (ActionButtonSpec + label: 'ST/X Look (Xft)' + name: 'Button10' + layout: (LayoutFrame 148 0.0 99 0 298 0 121 0) + activeHelpKey: changeToSTXLookXft + translateLabel: true + tabable: true + model: changeToSTXLookXft + enableChannel: hasXftFonts + ) + ) + + ) + extent: (Point 635 124) + ) + ) + + ) + ) + ) + + ) + ) +! ! + +!FontSettingsApplication methodsFor:'accessing'! + +encodingMatch:aEncodingMatch + + aEncodingMatch notNil ifTrue:[ + filter := [:f | f encoding notNil + and:[aEncodingMatch match:f encoding]]. + ]. +! ! + +!FontSettingsApplication methodsFor:'actions'! + +basicReadFontSettings +"/ View readStyleSheetAndUpdateAllStyleCaches. + self allOfThem value:SimpleView defaultFont. + self otherDef value:SimpleView defaultFont. + self labelDef value:Label defaultFont. + self buttonDef value:Button defaultFont. + self listDef value:SelectionInListView defaultFont. + self menuDef value:MenuView defaultFont. + self textDef value:TextView defaultFont. + self inputFieldDef value:EditField defaultFont. + + "Modified: / 10-10-2011 / 12:15:31 / Jan Vrany " + "Created: / 06-02-2012 / 12:22:39 / cg" +! + +basicReadSettings + self basicReadFontSettings. + + self readAspects: #(linuxFontWorkaround) from: currentUserPrefs + + "Modified: / 10-10-2011 / 12:15:31 / Jan Vrany " + "Modified: / 06-02-2012 / 12:22:51 / cg" +! + +basicSaveSettings + |fn| + + fn := self otherDef value. + SimpleView withAllSubclasses do:[:cls | cls defaultFont:fn]. + + fn := self labelDef value. + Label defaultFont:fn. + CheckBox defaultFont:fn. + + fn := self buttonDef value. + Button defaultFont:fn. + Toggle defaultFont:fn. + + fn := self textDef value. + TextView withAllSubclasses do:[:cls | cls defaultFont:fn]. + + fn := self inputFieldDef value. + EditField withAllSubclasses do:[:cls | cls defaultFont:fn]. + + fn := self listDef value. + SelectionInListView withAllSubclasses do:[:cls | cls defaultFont:fn]. + + fn := self menuDef value. + ListView defaultFont:fn. + MenuView defaultFont:fn. + MenuPanel defaultFont:fn. + NoteBookView defaultFont:fn. + PullDownMenu defaultFont:fn. + + self writeAspects: #(linuxFontWorkaround) to: currentUserPrefs + + "Modified: / 10-10-2011 / 12:15:56 / Jan Vrany " +! + +changeAllFont + |f| + + self withWaitCursorDo:[ + f := FontPanel + fontFromUserInitial:(self allOfThem value) + title:(resources string:'Font for %1' with:'All') + filter:filter. + ]. + f notNil ifTrue:[ + "/ self allOfThem value:(f onDevice:allLabel device). + self otherDef value:(f onDevice:otherLabel device). + self labelDef value:(f onDevice:labelLabel device). + self buttonDef value:(f onDevice:buttonsLabel device). + self listDef value:(f onDevice:listsLabel device). + self menuDef value:(f onDevice:menuLabel device). + self textDef value:(f onDevice:textLabel device). + self inputFieldDef value:(f onDevice:inputFieldLabel device). + ] +! + +changeButtonsFont + self changeFontFor:self buttonDef labelTitle:'Buttons'. +"/ +"/ |f| +"/ +"/ f := FontPanel +"/ fontFromUserInitial:(self buttonDef value) +"/ title:(resources string:'Font for %1' with:'All') +"/ filter:filter. +"/ f notNil ifTrue:[ +"/ self buttonDef value:(f onDevice:buttonsLabel device). +"/ ] +! + +changeFontFor:aHolder labelTitle:labelTitle + |f | + + self withWaitCursorDo:[ + f := FontPanel + fontFromUserInitial:(aHolder value) + title:(resources string:'Font for %1' with:labelTitle) + filter:filter. + ]. + f notNil ifTrue:[ + aHolder value:(f onDevice:self graphicsDevice). + ]. +! + +changeInputFieldFont + self changeFontFor:self inputFieldDef labelTitle:'Input Fields'. +"/ |f| +"/ +"/ f := FontPanel +"/ fontFromUserInitial:(self inputFieldDef value) +"/ title:(resources string:'Font for %1' with:'Input Fields') +"/ filter:filter. +"/ f notNil ifTrue:[ +"/ self inputFieldDef value:(f onDevice:inputFieldLabel device). +"/ ] +! + +changeLabelsFont + self changeFontFor:self labelDef labelTitle:'Labels'. +"/ |f | +"/ +"/ f := FontPanel +"/ fontFromUserInitial:(self labelDef value) +"/ title:(resources string:'Font for %1' with:'Labels') +"/ filter:filter. +"/ f notNil ifTrue:[ +"/ self labelDef value:(f onDevice:labelLabel device). +"/ ]. +! + +changeListsFont + self changeFontFor:self listDef labelTitle:'Lists'. +"/ |f| +"/ +"/ f := FontPanel +"/ fontFromUserInitial:(self listDef value) +"/ title:(resources string:'Font for %1' with:'Lists') +"/ filter:filter. +"/ f notNil ifTrue:[ +"/ self listDef value:(f onDevice:listsLabel device). +"/ ] +! + +changeMenusFont + self changeFontFor:self menuDef labelTitle:'Menus'. +"/ |f| +"/ +"/ f := FontPanel +"/ fontFromUserInitial:(self menuDef value) +"/ title:(resources string:'Font for %1' with:'Menus') +"/ filter:filter. +"/ f notNil ifTrue:[ +"/ self menuDef value:(f onDevice:menuLabel device). +"/ ] +! + +changeOtherFont + self changeFontFor:self otherDef labelTitle:'All Others'. +"/ |f| +"/ +"/ f := FontPanel +"/ fontFromUserInitial:(self otherDef value) +"/ title:(resources string:'Font for %1' with:'All Others') +"/ filter:filter. +"/ f notNil ifTrue:[ +"/ self otherDef value:(f onDevice:otherLabel device). +"/ ] +! + +changeTextFont + self changeFontFor:self textDef labelTitle:'Edited Text'. +"/ |f| +"/ +"/ f := FontPanel +"/ fontFromUserInitial:(self textDef value) +"/ title:(resources string:'Font for %1' with:'Edited Text') +"/ filter:filter. +"/ f notNil ifTrue:[ +"/ self textDef value:(f onDevice:textLabel device). +"/ ] +! ! + +!FontSettingsApplication methodsFor:'actions-common looks'! + +changeToBigFonts + |fixFont variableFont| + +"/ fixFont := (Font family:'courier cew' face:'bold' style:'roman' size:14). +"/ variableFont := (Font family:'arial' face:'bold' style:'roman' size:14). + fixFont := (TextView defaultFont asSize:14) asFace:'bold'. + variableFont := (Label defaultFont asSize:14) asFace:'bold'. + self changeToFix:fixFont variable:variableFont. + + "Created: / 06-02-2012 / 12:12:55 / cg" +! + +changeToDefault + "/View readStyleSheetAndUpdateAllStyleCaches. + View updateAllStyleCaches. + self basicReadFontSettings. + + "Created: / 06-02-2012 / 12:06:00 / cg" +! + +changeToFix:fixFont variable:variableFont + self textDef value:fixFont. + self inputFieldDef value:fixFont. + + self menuDef value:variableFont. + self listDef value:variableFont. + self labelDef value:variableFont. + self buttonDef value:variableFont. + self otherDef value:variableFont. + + self allOfThem value:variableFont. + + "Created: / 06-02-2012 / 12:18:34 / cg" +! + +changeToHighContrast + |fixFont variableFont| + +"/ fixFont := (Font family:'courier New' face:'bold' style:'roman' size:12). +"/ variableFont := (Font family:'arial' face:'bold' style:'roman' size:12). + fixFont := (TextView defaultFont asSize:12) asFace:'bold'. + variableFont := (Label defaultFont asSize:12) asFace:'bold'. + self changeToFix:fixFont variable:variableFont. + + "Created: / 06-02-2012 / 12:12:47 / cg" +! + +changeToHugeFonts + |fixFont variableFont| + +"/ fixFont := (Font family:'courier New' face:'bold' style:'roman' size:16). +"/ variableFont := (Font family:'arial' face:'bold' style:'roman' size:16). + fixFont := (TextView defaultFont asSize:18) asFace:'bold'. + variableFont := (Label defaultFont asSize:18) asFace:'bold'. + self changeToFix:fixFont variable:variableFont. + + "Created: / 17-03-2012 / 09:06:18 / cg" +! + +changeToSTXLook + |fixFont variableFont| + + fixFont := (Font family:'courier new' face:'medium' style:'roman' size:(TextView defaultFont size)). + variableFont := (Font family:'arial' face:'medium' style:'roman' size:(TextView defaultFont size)). + self changeToFix:fixFont variable:variableFont. + + "Created: / 17-03-2012 / 11:23:16 / cg" +! + +changeToSTXLookXft + |fixFont variableFont| + + XftFontDescription isNil ifTrue:[ + self changeToSTXLook. + ^ self. + ]. + + fixFont := (XftFontDescription family:'Courier 10 Pitch' face:'regular' style:'roman' size:(TextView defaultFont size)). + variableFont := (XftFontDescription family:'Arial' face:'regular' style:'roman' size:(Button defaultFont size)). + self changeToFix:fixFont variable:variableFont. +! + +changeToSqueakLook + |variableFont| + + variableFont := (Font family:'arial' face:'medium' style:'roman' size:(TextView defaultFont size)). + self changeToFix:variableFont variable:variableFont. + + "Created: / 17-03-2012 / 11:22:59 / cg" +! + +changeToVisualAgeLook + |variableFont variableBoldFont| + + variableBoldFont := (Font family:'arial' face:'bold' style:'roman' size:(TextView defaultFont size)). + variableFont := (Font family:'arial' face:'medium' style:'roman' size:(TextView defaultFont size)). + self changeToFix:variableBoldFont variable:variableBoldFont. + + self menuDef value:variableFont. + + "Created: / 17-03-2012 / 11:22:18 / cg" +! ! + +!FontSettingsApplication methodsFor:'aspects'! + +allFontLabelHolder + + allFontLabelHolder isNil ifTrue:[ + allFontLabelHolder := '' asValue. + ]. + ^ allFontLabelHolder. +! + +allOfThem + "return/create the 'allOfThem' value holder (automatically generated)" + + allOfThem isNil ifTrue:[ + allOfThem := ValueHolder new. + allOfThem addDependent:self. + ]. + ^ allOfThem +! + +buttonDef + "return/create the 'buttonDef' value holder (automatically generated)" + + buttonDef isNil ifTrue:[ + buttonDef := ValueHolder new. + buttonDef addDependent:self. + ]. + ^ buttonDef +! + +buttonsFontLabelHolder + + buttonsFontLabelHolder isNil ifTrue:[ + buttonsFontLabelHolder := '' asValue. + ]. + ^ buttonsFontLabelHolder. +! + +infoText + ^ (self resources + string:'FONT_SETTINGS_INFO' + default:'Please notice that any changes usually only affect new windows. +Existing windows usually remember their initial font as created. +If required, reopen some of the views, including the Launcher itself. + +Also notice: + unless you save your new settings, + only the current session is affected by changes here.') withCRs + + "Created: / 17-08-2010 / 10:52:00 / cg" +! + +inputFieldDef + inputFieldDef isNil ifTrue:[ + inputFieldDef := ValueHolder new. + inputFieldDef addDependent:self. + ]. + ^ inputFieldDef +! + +inputFieldFontLabelHolder + + inputFieldFontLabelHolder isNil ifTrue:[ + inputFieldFontLabelHolder := '' asValue. + ]. + ^ inputFieldFontLabelHolder. +! + +labelDef + "return/create the 'labelDef' value holder (automatically generated)" + + labelDef isNil ifTrue:[ + labelDef := ValueHolder new. + labelDef addDependent:self. + ]. + ^ labelDef +! + +labelsFontLabelHolder + + labelsFontLabelHolder isNil ifTrue:[ + labelsFontLabelHolder := '' asValue. + ]. + ^ labelsFontLabelHolder. +! + +linuxFontWorkaround + + linuxFontWorkaround isNil ifTrue:[ + linuxFontWorkaround := false asValue. + linuxFontWorkaround onChangeSend:#updateModifiedChannel to:self + + ]. + ^ linuxFontWorkaround. + + "Created: / 10-10-2011 / 12:14:26 / Jan Vrany " +! + +linuxFontWorkaroundVisible + + ^OperatingSystem getOSType == #linux + + "Created: / 10-10-2011 / 12:57:51 / Jan Vrany " +! + +listDef + "return/create the 'listDef' value holder (automatically generated)" + + listDef isNil ifTrue:[ + listDef := ValueHolder new. + listDef addDependent:self. + ]. + ^ listDef +! + +listsFontLabelHolder + + listsFontLabelHolder isNil ifTrue:[ + listsFontLabelHolder := '' asValue. + ]. + ^ listsFontLabelHolder. +! + +menuDef + "return/create the 'menuDef' value holder (automatically generated)" + + menuDef isNil ifTrue:[ + menuDef := ValueHolder new. + menuDef addDependent:self. + ]. + ^ menuDef +! + +menusFontLabelHolder + + menusFontLabelHolder isNil ifTrue:[ + menusFontLabelHolder := '' asValue. + ]. + ^ menusFontLabelHolder. +! + +otherDef + otherDef isNil ifTrue:[ + otherDef := ValueHolder new. + otherDef addDependent:self. + ]. + ^ otherDef +! + +otherFontLabelHolder + + otherFontLabelHolder isNil ifTrue:[ + otherFontLabelHolder := '' asValue. + ]. + ^ otherFontLabelHolder. +! + +textDef + "return/create the 'textDef' value holder (automatically generated)" + + textDef isNil ifTrue:[ + textDef := ValueHolder new. + textDef addDependent:self. + ]. + ^ textDef +! + +textFontLabelHolder + + textFontLabelHolder isNil ifTrue:[ + textFontLabelHolder := '' asValue. + ]. + ^ textFontLabelHolder. +! ! + +!FontSettingsApplication methodsFor:'change & update'! + +update:something with:aParameter from:changedObject + |whichLabel whichFontLabelHolder| + + builder notNil ifTrue:[ + changedObject == self allOfThem ifTrue:[ + whichLabel := allLabel. + whichFontLabelHolder := self allFontLabelHolder. + ]. + changedObject == self otherDef ifTrue:[ + whichLabel := otherLabel. + whichFontLabelHolder := self otherFontLabelHolder. + ]. + changedObject == self labelDef ifTrue:[ + whichLabel := labelLabel. + whichFontLabelHolder := self labelsFontLabelHolder. + ]. + changedObject == self buttonDef ifTrue:[ + whichLabel := buttonsLabel. + whichFontLabelHolder := self buttonsFontLabelHolder. + ]. + changedObject == self listDef ifTrue:[ + whichLabel := listsLabel. + whichFontLabelHolder := self listsFontLabelHolder. + ]. + changedObject == self menuDef ifTrue:[ + whichLabel := menuLabel. + whichFontLabelHolder := self menusFontLabelHolder. + ]. + changedObject == self textDef ifTrue:[ + whichLabel := textLabel. + whichFontLabelHolder := self textFontLabelHolder. + ]. + changedObject == self inputFieldDef ifTrue:[ + whichLabel := inputFieldLabel. + whichFontLabelHolder := self inputFieldFontLabelHolder. + ]. + whichLabel notNil ifTrue:[ + self updateFontOfLabel:whichLabel andFontNameHolder:whichFontLabelHolder from:changedObject. + ^ self. + ] + ]. + super update:something with:aParameter from:changedObject +! + +updateAllFontLabels + self update:#value with:nil from:self allOfThem. + self update:#value with:nil from:self otherDef. + self update:#value with:nil from:self labelDef. + self update:#value with:nil from:self buttonDef. + self update:#value with:nil from:self listDef. + self update:#value with:nil from:self menuDef. + self update:#value with:nil from:self textDef. + self update:#value with:nil from:self inputFieldDef. +! + +updateFontOfLabel:labelWidget andFontNameHolder:fontNameHolder from:changedObject + |f label| + + f := changedObject value. + labelWidget font:f. + label := f isNil ifTrue:[ + '' + ] ifFalse:[ + f userFriendlyName + ]. + fontNameHolder value:label. + self updateModifiedChannel +! ! + +!FontSettingsApplication methodsFor:'help'! + +helpFilename + ^ 'Launcher/fontSettings.html' +! ! + +!FontSettingsApplication methodsFor:'initialization & release'! + +postBuildAllFontLabel:aWidget + + allLabel := aWidget. +! + +postBuildButtonsFontLabel:aWidget + + buttonsLabel := aWidget. +! + +postBuildInputFieldFontLabel:aWidget + + inputFieldLabel := aWidget. +! + +postBuildLabelsFontLabel:aWidget + + labelLabel := aWidget. +! + +postBuildListsFontLabel:aWidget + + listsLabel := aWidget. +! + +postBuildMenuesFontLabel:aWidget + + menuLabel := aWidget. +! + +postBuildOtherFontLabel:aWidget + + otherLabel := aWidget. +! + +postBuildTextFontLabel:aWidget + + textLabel := aWidget. +! + +postBuildWith:aBuilder +"/ self readSettings. + self updateAllFontLabels. + super postBuildWith:aBuilder +! ! + +!FontSettingsApplication methodsFor:'queries'! + +hasUnsavedChanges + self otherDef value ~= View defaultFont ifTrue:[^ true]. + self labelDef value ~= Label defaultFont ifTrue:[^ true]. + self buttonDef value ~= Button defaultFont ifTrue:[^ true]. + self listDef value ~= SelectionInListView defaultFont ifTrue:[^ true]. + self menuDef value ~= MenuView defaultFont ifTrue:[^ true]. + self textDef value ~= TextView defaultFont ifTrue:[^ true]. + self inputFieldDef value ~= EditField defaultFont ifTrue:[^ true]. + + (self hasChangedAspectIn: #(linuxFontWorkaround) asComparedTo:currentUserPrefs) ifTrue:[^ true]. + + ^ false + + "Modified: / 10-10-2011 / 12:14:10 / Jan Vrany " +! + +hasXftFonts + ^ (Display platformName = 'X11') and:[ XftFontDescription notNil ] +! ! + +!FontSettingsApplication class methodsFor:'documentation'! + +version + ^ '$Header: /cvs/stx/stx/libtool/Tools__FontSettingsApplication.st,v 1.1 2014-04-13 17:23:37 cg Exp $' +! + +version_CVS + ^ '$Header: /cvs/stx/stx/libtool/Tools__FontSettingsApplication.st,v 1.1 2014-04-13 17:23:37 cg Exp $' +! ! +