--- a/AbstractLauncherApplication.st Tue Oct 26 15:58:14 1999 +0200
+++ b/AbstractLauncherApplication.st Wed Oct 27 19:30:02 1999 +0200
@@ -2853,9 +2853,9 @@
!
printerSettingsFor:requestor
- "open a dialog on printer related settings"
-
- |box
+ "open a dialog on printer related settings; returns true if accepted"
+
+ |box accepted
possiblePrinters possibleTypes printerType printCommand
pageFormat landscape updater
formatLabel formatComponent landscapeLabel landscapeComponent
@@ -2912,12 +2912,12 @@
commandList := resources at:'PRINT_COMMANDS' ifAbsent:nil.
commandList isNil ifTrue:[
- commandList := PrinterStream defaultCommands.
- commandList isNil ifTrue:[
- commandList := #('lpr'
- 'lp'
- ).
- ]
+ commandList := PrinterStream defaultCommands.
+ commandList isNil ifTrue:[
+ commandList := #('lpr'
+ 'lp'
+ ).
+ ]
].
commandListPop list:commandList.
@@ -2936,24 +2936,24 @@
y := box yPosition.
box
- addRow:(1 to:2)
- fromX:0
- toX:0.5
- collect:[:idx | row at:idx]
- tabable:false
- horizontalLayout:#leftSpace
- verticalLayout:#center.
+ addRow:(1 to:2)
+ fromX:0
+ toX:0.5
+ collect:[:idx | row at:idx]
+ tabable:false
+ horizontalLayout:#leftSpace
+ verticalLayout:#center.
y1 := box yPosition.
box yPosition:y.
box
- addRow:(3 to:4)
- fromX:0.5
- toX:1.0
- collect:[:idx | row at:idx]
- tabable:false
- horizontalLayout:#leftSpace
- verticalLayout:#center.
+ addRow:(3 to:4)
+ fromX:0.5
+ toX:1.0
+ collect:[:idx | row at:idx]
+ tabable:false
+ horizontalLayout:#leftSpace
+ verticalLayout:#center.
box yPosition:(box yPosition max:y1).
@@ -2965,12 +2965,12 @@
y := box yPosition.
topMarginComponent := box
- addLabelledInputField:(resources string:'top margin:')
- adjust:#right
- on:nil "/ topMargin
- tabable:true
- from:0.0 to:0.5
- separateAtX:0.6.
+ addLabelledInputField:(resources string:'top margin:')
+ adjust:#right
+ on:nil "/ topMargin
+ tabable:true
+ from:0.0 to:0.5
+ separateAtX:0.6.
topMarginComponent converter:(PrintConverter new initForNumber).
topMarginComponent model:topMargin.
y1 := box yPosition.
@@ -2981,38 +2981,38 @@
component := box addComponent:(PopUpList on:unitList).
component
- left:0.6;
- width:0.3.
+ left:0.6;
+ width:0.3.
box yPosition:y1.
leftMarginComponent := box
- addLabelledInputField:(resources string:'left margin:')
- adjust:#right
- on:nil "/ leftMargin
- tabable:true
- from:0.0 to:0.5
- separateAtX:0.6.
+ addLabelledInputField:(resources string:'left margin:')
+ adjust:#right
+ on:nil "/ leftMargin
+ tabable:true
+ from:0.0 to:0.5
+ separateAtX:0.6.
leftMarginComponent converter:(PrintConverter new initForNumber).
leftMarginComponent model:leftMargin.
rightMarginComponent := box
- addLabelledInputField:(resources string:'right margin:')
- adjust:#right
- on:nil "/ rightMargin
- tabable:true
- from:0.0 to:0.5
- separateAtX:0.6.
+ addLabelledInputField:(resources string:'right margin:')
+ adjust:#right
+ on:nil "/ rightMargin
+ tabable:true
+ from:0.0 to:0.5
+ separateAtX:0.6.
rightMarginComponent converter:(PrintConverter new initForNumber).
rightMarginComponent model:rightMargin.
bottomMarginComponent := box
- addLabelledInputField:(resources string:'bottom margin:')
- adjust:#right
- on:nil "/ bottomMargin
- tabable:true
- from:0.0 to:0.5
- separateAtX:0.6.
+ addLabelledInputField:(resources string:'bottom margin:')
+ adjust:#right
+ on:nil "/ bottomMargin
+ tabable:true
+ from:0.0 to:0.5
+ separateAtX:0.6.
bottomMarginComponent converter:(PrintConverter new initForNumber).
bottomMarginComponent model:bottomMargin.
@@ -3022,104 +3022,105 @@
updater := [ |p fg hasPageSize hasMargins|
- printerType selectionIndex ~~ 0 ifTrue:[
- p := possiblePrinters at:(printerType selectionIndex).
- hasPageSize := p supportsPageSizes.
- hasMargins := p supportsMargins.
- ] ifFalse:[
- hasPageSize := false.
- hasMargins := false.
- ].
- hasPageSize ifTrue:[
- fg := Button new foregroundColor.
- formatComponent enable.
- landscapeComponent enable.
-
- formatComponent label:p pageFormat.
- pageFormat value:(p pageFormat).
- landscape value:(p landscape).
- ] ifFalse:[
- fg := Button new disabledForegroundColor.
- formatComponent disable.
- landscapeComponent disable.
-
- formatComponent label:'unknown'.
- landscape value:nil.
- ].
- hasMargins ifTrue:[
- unitList selectionIndex == 2 ifTrue:[
- unit := #mm
- ] ifFalse:[
- unit := #inch
- ].
-
- topMargin value:(UnitConverter convert:p topMargin from:#inch to:unit).
- leftMargin value:(UnitConverter convert:p leftMargin from:#inch to:unit).
- rightMargin value:(UnitConverter convert:p rightMargin from:#inch to:unit).
- bottomMargin value:(UnitConverter convert:p bottomMargin from:#inch to:unit).
-
- topMarginComponent enable.
- leftMarginComponent enable.
- rightMarginComponent enable.
- bottomMarginComponent enable.
- ] ifFalse:[
- topMarginComponent disable.
- leftMarginComponent disable.
- rightMarginComponent disable.
- bottomMarginComponent disable.
- ].
- formatLabel foregroundColor:fg.
- landscapeLabel foregroundColor:fg.
-
- p notNil ifTrue:[
- commandList := p defaultCommands.
- commandList notNil ifTrue:[
- commandListPop list:commandList
- ].
-
- printCommand value:(p printCommand).
- ].
- p supportsPostscript ifFalse:[
- supportsColorComponent disable.
- supportsColor value:false
- ] ifTrue:[
- supportsColorComponent enable.
- supportsColor value:(Printer supportsColor).
- ]
- ].
+ printerType selectionIndex ~~ 0 ifTrue:[
+ p := possiblePrinters at:(printerType selectionIndex).
+ hasPageSize := p supportsPageSizes.
+ hasMargins := p supportsMargins.
+ ] ifFalse:[
+ hasPageSize := false.
+ hasMargins := false.
+ ].
+ hasPageSize ifTrue:[
+ fg := Button new foregroundColor.
+ formatComponent enable.
+ landscapeComponent enable.
+
+ formatComponent label:p pageFormat.
+ pageFormat value:(p pageFormat).
+ landscape value:(p landscape).
+ ] ifFalse:[
+ fg := Button new disabledForegroundColor.
+ formatComponent disable.
+ landscapeComponent disable.
+
+ formatComponent label:'unknown'.
+ landscape value:nil.
+ ].
+ hasMargins ifTrue:[
+ unitList selectionIndex == 2 ifTrue:[
+ unit := #mm
+ ] ifFalse:[
+ unit := #inch
+ ].
+
+ topMargin value:(UnitConverter convert:p topMargin from:#inch to:unit).
+ leftMargin value:(UnitConverter convert:p leftMargin from:#inch to:unit).
+ rightMargin value:(UnitConverter convert:p rightMargin from:#inch to:unit).
+ bottomMargin value:(UnitConverter convert:p bottomMargin from:#inch to:unit).
+
+ topMarginComponent enable.
+ leftMarginComponent enable.
+ rightMarginComponent enable.
+ bottomMarginComponent enable.
+ ] ifFalse:[
+ topMarginComponent disable.
+ leftMarginComponent disable.
+ rightMarginComponent disable.
+ bottomMarginComponent disable.
+ ].
+ formatLabel foregroundColor:fg.
+ landscapeLabel foregroundColor:fg.
+
+ p notNil ifTrue:[
+ commandList := p defaultCommands.
+ commandList notNil ifTrue:[
+ commandListPop list:commandList
+ ].
+
+ printCommand value:(p printCommand).
+ ].
+ p supportsPostscript ifFalse:[
+ supportsColorComponent disable.
+ supportsColor value:false
+ ] ifTrue:[
+ supportsColorComponent enable.
+ supportsColor value:(Printer supportsColor).
+ ]
+ ].
unitList onChangeSend:#value to:updater.
printerType onChangeSend:#value to:updater.
updater value.
box addVerticalSpace;
- addHelpButtonFor:'Launcher/printerSettings.html';
- addAbortAndOkButtons.
+ addHelpButtonFor:'Launcher/printerSettings.html';
+ addAbortAndOkButtons.
box open.
- box accepted ifTrue:[
- Printer := possiblePrinters at:(printerType selectionIndex).
- Printer printCommand:printCommand value.
-
- Printer supportsPageSizes ifTrue:[
- Printer pageFormat:(pageFormat selection).
- Printer landscape:(landscape value).
- ].
- Printer supportsMargins ifTrue:[
- unitList selectionIndex == 2 ifTrue:[
- unit := #mm
- ] ifFalse:[
- unit := #inch
- ].
- Printer topMargin:(UnitConverter convert:topMargin value from:unit to:#inch).
- Printer leftMargin:(UnitConverter convert:leftMargin value from:unit to:#inch).
- Printer rightMargin:(UnitConverter convert:rightMargin value from:unit to:#inch).
- Printer bottomMargin:(UnitConverter convert:bottomMargin value from:unit to:#inch).
- ].
- Printer supportsPostscript ifTrue:[
- Printer supportsColor:supportsColor value.
- ].
+ (accepted := box accepted) ifTrue:[
+ Printer := possiblePrinters at:(printerType selectionIndex).
+ Printer printCommand:printCommand value.
+
+ Printer supportsPageSizes ifTrue:[
+ Printer pageFormat:(pageFormat selection).
+ Printer landscape:(landscape value).
+ ].
+ Printer supportsMargins ifTrue:[
+ unitList selectionIndex == 2 ifTrue:[
+ unit := #mm
+ ] ifFalse:[
+ unit := #inch
+ ].
+ Printer topMargin:(UnitConverter convert:topMargin value from:unit to:#inch).
+ Printer leftMargin:(UnitConverter convert:leftMargin value from:unit to:#inch).
+ Printer rightMargin:(UnitConverter convert:rightMargin value from:unit to:#inch).
+ Printer bottomMargin:(UnitConverter convert:bottomMargin value from:unit to:#inch).
+ ].
+ Printer supportsPostscript ifTrue:[
+ Printer supportsColor:supportsColor value.
+ ].
].
- box destroy
+ box destroy.
+ ^ accepted
"Modified: 9.9.1996 / 22:43:51 / stefan"
"Modified: 28.2.1997 / 14:00:13 / cg"
@@ -3168,10 +3169,9 @@
Will move entries over to UserPreferences over time;
new items should always go there."
- |s screen fileName resources currentUserPrefs|
+ |fileName resources|
resources := requestor class classResources.
- currentUserPrefs := UserPreferences current.
fileName := Dialog
requestFileName:(resources string:'save settings in:')
@@ -3181,6 +3181,19 @@
pattern:'*.stx'
fromDirectory:nil.
+ self saveSettingsFor:requestor in:fileName.
+!
+
+saveSettingsFor:requestor in:fileName
+ "save settings to a settings-file."
+
+ "a temporary kludge - we need a central systemSettings object for this,
+ which can be saved/restored with a single store/read.
+ Will move entries over to UserPreferences over time;
+ new items should always go there."
+
+ |s screen currentUserPrefs|
+
(fileName size == 0) ifTrue:[
"/ canceled
^ self
@@ -3192,6 +3205,8 @@
^ self
].
+ currentUserPrefs := UserPreferences current.
+
s nextPutLine:'"/ ST/X saved settings';
nextPutLine:'"/ DO NOT MODIFY MANUALLY';
nextPutLine:'"/ (modifications would be lost with next save-settings)';
@@ -4804,5 +4819,5 @@
!AbstractLauncherApplication class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/AbstractLauncherApplication.st,v 1.82 1999-09-17 09:45:14 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/AbstractLauncherApplication.st,v 1.83 1999-10-27 17:30:02 ca Exp $'
! !