home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
editoropti.tcl
< prev
next >
Wrap
Text File
|
1997-02-12
|
6KB
|
216 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)editoropti.tcl /main/hindenburg/4
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)editoropti.tcl /main/hindenburg/4 12 Feb 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
# End user added include file section
require "tooloption.tcl"
Class EditorOptions : {ToolOptions} {
constructor
method destructor
method scaleFont
method zoomOut
method zoomIn
method normalFont
method annotationFont
method boldFont
method foreground
method background
method selectionColor
method grid
method printOptions
method initialFold
}
constructor EditorOptions {class this name} {
set this [ToolOptions::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method EditorOptions::destructor {this} {
# Start destructor user section
# End destructor user section
$this ToolOptions::destructor
}
method EditorOptions::scaleFont {this font factor} {
set sep1 [string first "-" $font]
if {$sep1 != -1} {
set head [string range $font 0 $sep1]
set tail [string range $font [incr sep1] end]
set sep2 [string first "-" $tail]
if {$sep2 != -1} {
append head [string range $tail 0 $sep2]
set size [string range $tail [incr sep2] end]
return [format %s%.0f $head [expr $size * $factor]]
}
}
return $font
}
method EditorOptions::zoomOut {this} {
.main zoom 0.75
set scale [[.main editorArea] scale]
if {[m4_var get M4_zoom] != $scale} {
catch {m4_var set M4_zoom $scale}
}
}
method EditorOptions::zoomIn {this} {
.main zoom 1.333333333333
set scale [[.main editorArea] scale]
if {[m4_var get M4_zoom] != $scale} {
catch {m4_var set M4_zoom $scale}
}
}
method EditorOptions::normalFont {this} {
busy {
uplevel #0 require udefontcho.tcl
set scale [[.main editorArea] scale]
set scaledFont [$this scaleFont [m4_var get M4_font -context ude] $scale]
UdeFontChooser new .main.normalFont \
-options $this \
-title "Normal Font" \
-orgFont "$scaledFont" \
-value "$scaledFont" \
-cancelPressed {%this delete} \
-okPressed {
set scale [expr 1 / [[.main editorArea] scale]]
set scaledFont [[%this options] scaleFont [%this value] $scale]
if {[%this orgFont] != "$scaledFont"} {
[.main editorArea] normalFontSpec "$scaledFont"
catch {m4_var set M4_font "$scaledFont" -context ude}
}
%this delete
}
}
.main.normalFont popUp
}
method EditorOptions::annotationFont {this} {
busy {
uplevel #0 require udefontcho.tcl
set scale [[.main editorArea] scale]
set scaledFont [$this scaleFont [m4_var get M4_font_annotation -context ude] $scale]
UdeFontChooser new .main.annotationFont \
-options $this \
-title "Annotation Font" \
-orgFont "$scaledFont" \
-value "$scaledFont" \
-cancelPressed {%this delete} \
-okPressed {
set scale [expr 1 / [[.main editorArea] scale]]
set scaledFont [[%this options] scaleFont [%this value] $scale]
if {[%this orgFont] != "$scaledFont"} {
[.main editorArea] annotationFontSpec "$scaledFont"
catch {m4_var set M4_font_annotation "$scaledFont" -context ude}
}
%this delete
}
}
.main.annotationFont popUp
}
method EditorOptions::boldFont {this} {
busy {
uplevel #0 require udefontcho.tcl
set scale [[.main editorArea] scale]
set scaledFont [$this scaleFont [m4_var get M4_font_bold -context ude] $scale]
UdeFontChooser new .main.boldFont \
-options $this \
-title "Bold Font" \
-orgFont "$scaledFont" \
-value "$scaledFont" \
-cancelPressed {%this delete} \
-okPressed {
set scale [expr 1 / [[.main editorArea] scale]]
set scaledFont [[%this options] scaleFont [%this value] $scale]
if {[%this orgFont] != "$scaledFont"} {
[.main editorArea] boldFontSpec "$scaledFont"
catch {m4_var set M4_font_bold "$scaledFont" -context ude}
}
%this delete
}
}
.main.boldFont popUp
}
method EditorOptions::foreground {this} {
uplevel #0 require udecolorch.tcl
UdeColorChooser new .main.fg \
-options $this \
-title "Foreground" \
-value [m4_var get M4_fg -context ude] \
-cancelPressed {%this delete} \
-okPressed {
if {[m4_var get M4_fg -context ude] != [%this value]} {
[.main editorArea] areaForeground [%this value]
catch {m4_var set M4_fg [%this value] -context ude}
}
%this delete
}
.main.fg popUp
}
method EditorOptions::background {this} {
uplevel #0 require udecolorch.tcl
UdeColorChooser new .main.bg \
-options $this \
-title "Background" \
-value [m4_var get M4_bg -context ude] \
-cancelPressed {%this delete} \
-okPressed {
if {[m4_var get M4_bg -context ude] != [%this value]} {
[.main editorArea] areaBackground [%this value]
catch {m4_var set M4_bg [%this value] -context ude}
}
%this delete
}
.main.bg popUp
}
method EditorOptions::selectionColor {this} {
uplevel #0 require udecolorch.tcl
UdeColorChooser new .main.selColor \
-options $this \
-title "Selection Color" \
-value [m4_var get M4_sel_color -context ude] \
-cancelPressed {%this delete} \
-okPressed {
if {[m4_var get M4_sel_color -context ude] != [%this value]} {
[.main editorArea] areaSelectionColor [%this value]
catch {m4_var set M4_sel_color [%this value] -context ude}
}
%this delete
}
.main.selColor popUp
}
method EditorOptions::grid {this} {
uplevel #0 require griddialog.tcl
GridDialog new .main.grid -area [.main editorArea]
.main.grid popUp
}
method EditorOptions::printOptions {this} {
.main popUpPrintOptions
}
method EditorOptions::initialFold {this} {
m4_var set M4_initial_fold [[.main menuBar].options.menu.initialfold state]
}
# Do not delete this line -- regeneration end marker