home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1997
- #
- # File: @(#)editoropti.tcl /main/titanic/13
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)editoropti.tcl /main/titanic/13 5 Nov 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 selectConnectors
- method initialFold
- method look
- method initLook
- method showVisibility
- method initShowVisibility
- }
-
- 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 tail1 [string range $font [incr sep1] end]
- set sep2 [string first "-" $tail1]
- if {$sep2 != -1} {
- append head [string range $tail1 0 $sep2]
- set tail2 [string range $tail1 [incr sep2] end]
- set sep3 [string first "-" $tail2]
- if {$sep3 != -1} {
- set size [string range $tail2 0 [incr sep3 -1]]
- } else {
- set size $tail2
- }
- return $head[expr round($size * $factor)]
- }
- }
- return $font
- }
-
- method EditorOptions::zoomOut {this} {
- .main zoom 0.75
- set scale [[.main editorArea] scale]
- if {[m4_var get M4_zoom -context ude] != $scale} {
- catch {m4_var set M4_zoom $scale -context ude}
- }
- }
-
- method EditorOptions::zoomIn {this} {
- .main zoom 1.333333333333
- set scale [[.main editorArea] scale]
- if {[m4_var get M4_zoom -context ude] != $scale} {
- catch {m4_var set M4_zoom $scale -context ude}
- }
- }
-
- method EditorOptions::normalFont {this} {
- busy {
- uplevel #0 require udefontcho.tcl
- set scale [[.main editorArea] scale]
- set font [m4_var get M4_font -context ude]
- set scaledFont [$this scaleFont $font $scale]
- UdeFontChooser new .main.normalFont \
- -options $this \
- -title "Normal Font" \
- -orgFont $font \
- -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 font [m4_var get M4_font_annotation -context ude]
- set scaledFont [$this scaleFont $font $scale]
- UdeFontChooser new .main.annotationFont \
- -options $this \
- -title "Annotation Font" \
- -orgFont $font \
- -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 font [m4_var get M4_font_bold -context ude]
- set scaledFont [$this scaleFont $font $scale]
- UdeFontChooser new .main.boldFont \
- -options $this \
- -title "Bold Font" \
- -orgFont $font \
- -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::selectConnectors {this} {
- set selectConns [[.main menuBar].options.menu.selectconnectorstoo state]
- m4_var set M4_select_conns $selectConns -context [.main diagramType]
- [.main editorArea] selectConnectorsToo $selectConns
- }
-
- method EditorOptions::initialFold {this} {
- set initialFold [[.main menuBar].options.menu.initialfold state]
- m4_var set M4_initial_fold $initialFold -context [.main diagramType]
- }
-
- method EditorOptions::look {this} {
- set uml [[.main menuBar].options.menu.UML state]
- if $uml {
- set look UML
- } else {
- set look OMT
- }
-
- .main switchLook $look
- # the switch action may have been cancelled:
- set finalLook [m4_var get M4_diagram_look]
- [.main menuBar].options.menu.$finalLook state 1
- }
-
- method EditorOptions::initLook {this} {
- set look [m4_var get M4_diagram_look]
- [.main menuBar].options.menu.$look state 1
- }
-
- method EditorOptions::showVisibility {this} {
- [.main editorArea] getSelectedComponents
- set showVisibility [[.main menuBar].options.menu.showvisibility state]
- set cc [ClientContext::global]
- set pv [$cc currentPhase]
- set context [[$pv phase] type]
- catch {m4_var set M4_show_visibility $showVisibility -context $context}
- [.main editorArea] updateEditorComponents false
- }
-
- method EditorOptions::initShowVisibility {this} {
- set svButton [.main menuBar].options.menu.showvisibility
- if [isCommand $svButton] {
- set cc [ClientContext::global]
- set pv [$cc currentPhase]
- set context [[$pv phase] type]
- $svButton state [m4_var get M4_show_visibility \
- -context $context]
- }
- }
-
- # Do not delete this line -- regeneration end marker
-
-