proc prepareRangeValue { formHandle index } {
set rValue "[$formHandle readInputField ranges($index).range]"
return $rValue;
}
proc prepareLabelValue { formHandle index } {
set lValue "[$formHandle readInputField ranges($index).label]"
return $lValue;
}
proc prepareStringValue { formHandle index } {
set sValue "line_colour~[$formHandle readInputField ranges($index).line_colour]!"
append sValue "line_weight~[$formHandle readInputField ranges($index).line_weight]!"
append sValue "line_pattern~[$formHandle readInputField ranges($index).line_pattern]!"
append sValue "line_join~[$formHandle readInputField ranges($index).line_join]!"
append sValue "line_end~[$formHandle readInputField ranges($index).line_end]"
return $sValue
}
proc prepareMarkerValue {formHandle index } {
set mValue "marker_symbol~[$formHandle readInputField ranges($index).marker_symbol]!"
append mValue "marker_size~[$formHandle readInputField ranges($index).marker_size]"
return $mValue
}
proc preparePolygonValue {formHandle index } {
set transmissionColor [$formHandle readInputField ranges($index).transmission]
if {$transmissionColor == ""} {
set transmissionColor "none"
}
set pValue "face_colour~[$formHandle readInputField ranges($index).face_colour]!"
append pValue "edge_weight~[$formHandle readInputField ranges($index).edge_weight]!"
append pValue "edge_pattern~[$formHandle readInputField ranges($index).edge_pattern]!"
append pValue "specular~[$formHandle readInputField ranges($index).specular]!"
append pValue "transmission~$transmissionColor!"
append pValue "gloss~[$formHandle readInputField ranges($index).gloss]!"
append pValue "face_pattern~[$formHandle readInputField ranges($index).face_pattern]"
return $pValue
}
proc setupTable {formHandle} {
global def_range
global def_stringLabel
global def_s
global def_m
global def_p
global def_t
global range
global stringLabel
global s
global m
global p
global t
set buffer [ GuidoExecServer ServerGetSelectedLegendItem { } ]
set path [GuidoGetParamBufferValue $buffer path]
$def_range setCurrentValue 0 [GuidoMessage translate Default]
$def_stringLabel setCurrentValue 0 [$formHandle readInputField deft_label]
set sValue "line_colour~[$formHandle readInputField deft_line_colour]!"
append sValue "line_weight~[$formHandle readInputField deft_line_weight]!"
append sValue "line_pattern~[$formHandle readInputField deft_line_pattern]!"
append sValue "line_join~[$formHandle readInputField deft_line_join]!"
append sValue "line_end~[$formHandle readInputField deft_line_end]"
$def_s setCurrentValue 0 $sValue
set mValue "marker_symbol~[$formHandle readInputField deft_marker_symbol]!"
append mValue "marker_size~[$formHandle readInputField deft_marker_size]"
$def_m setCurrentValue 0 $mValue
set transmissionColor [$formHandle readInputField deft_transmission]
if {$transmissionColor == ""} {
set transmissionColor "none"
}
set pValue "face_colour~[$formHandle readInputField deft_face_colour]!"
append pValue "edge_weight~[$formHandle readInputField deft_edge_weight]!"
append pValue "edge_pattern~[$formHandle readInputField deft_edge_pattern]!"
append pValue "specular~[$formHandle readInputField deft_specular]!"
append pValue "transmission~$transmissionColor!"
append pValue "gloss~[$formHandle readInputField deft_gloss]!"
append pValue "face_pattern~[$formHandle readInputField deft_face_pattern]"
$def_p setCurrentValue 0 $pValue
$def_t setEditingCell -1 -1
set numberOfRows [$formHandle numberInputFields ranges]
set index 0
$t setInitialRows $numberOfRows 2 1000
set useRow -1
set useCol -1
for {set row 0} {$row < $numberOfRows} {incr row} {
$range setCurrentValue $row [prepareRangeValue $formHandle $index]
$stringLabel setCurrentValue $row [prepareLabelValue $formHandle $index]
if {$path > ""} {
if {$path == [prepareLabelValue $formHandle $index]} {
set useRow $row
set useCol 1
} else {
if {$path == [prepareRangeValue $formHandle $index]} {
set useRow $row
set useCol 0
}
}
}
$s setCurrentValue $row [prepareStringValue $formHandle $index]
$m setCurrentValue $row [prepareMarkerValue $formHandle $index]
$p setCurrentValue $row [preparePolygonValue $formHandle $index]
incr index
}
if {$useRow > -1} {
$t setEditingCell $useRow $useCol
} else {
$def_t setEditingCell 0 1
}
global save_now
global styles_file
$save_now setCurrentValue [$formHandle readInputField save_now]
$styles_file setCurrentValue [$formHandle readInputField styles_file]
}
proc writeNormalValues {formHandle prefix value} {
set valueList [split $value ~!]
for {set index 0 } {$index < [llength $valueList]} {incr index 2} {
set listKey [lindex $valueList $index]
if {[string compare $listKey "transmission"] ==  0} {
if {[string compare [lindex $valueList [expr $index +1]] "none"] ==  0} {
set listValue ""
} else {
set listValue [lindex $valueList [expr $index +1] ]
}
} else {
set listValue [lindex $valueList [expr $index +1] ]
}
$formHandle writeOutputField "$prefix$listKey" $listValue
}
}
proc writeOutTable {formHandle} {
global def_range
global def_stringLabel
global def_s
global def_m
global def_p
global def_t
global range
global stringLabel
global s
global m
global p
global t
if { [string compare [$formHandle getStatus] "legacy preprocess apply"] ==  0 } {
$formHandle preprocessInit
$formHandle writeOutputField "deft_label" [$def_stringLabel getCurrentValue 0]
writeNormalValues $formHandle "deft_" [$def_s getCurrentValue 0]
writeNormalValues $formHandle "deft_" [$def_m getCurrentValue 0]
writeNormalValues $formHandle "deft_" [$def_p getCurrentValue 0]
set numberOfRows [$t getRowCount]
set rangeName range
set labelName label
set index 0
$formHandle writeOutputField "GuidoTableRowCounter.ranges" $numberOfRows
for {set row 0} {$row < $numberOfRows} {incr row} {
set prefix "ranges($index)."
incr index
$formHandle writeOutputField "$prefix$rangeName" [$range getCurrentValue $row]
$formHandle writeOutputField "$prefix$labelName" [$stringLabel getCurrentValue $row]
writeNormalValues $formHandle $prefix [$s getCurrentValue $row]
writeNormalValues $formHandle $prefix [$m getCurrentValue $row]
writeNormalValues $formHandle $prefix [$p getCurrentValue $row]
}
global save_now
global styles_file
$formHandle writeOutputField "save_now" [$save_now getCurrentValue]
$formHandle writeOutputField "styles_file" [$styles_file getCurrentValue]
$formHandle finishedWritingFields
}
}
GuidoForm frm00337 {
-help_id 1281
-action initial {[setupTable $frm00337]}
-action stateChanged {[writeOutTable $frm00337 ]}
-label "Set Object Drawing Styles"
-default_buttons
-tip "00337_TIP_001"
GuidoPanel pws {
-layout BoxLayout Y_AXIS
GuidoLabel label1 {
-height 1.1
-label "Default Style"
-font_style bold
}
GuidoScrollPane def_sp {
GuidoTable def_t {
-instances 1 1 1
-blank_row_headings true
-column_sorting false
GuidoLabel def_range {
-label Range
-display_length 8
}
GuidoField def_stringLabel {
-display_length 8
-label Label
-tip STYLES_LABEL_TIP
}
StringLineStyles def_s {
-label Edges
-tip STYLES_STRING_TIP
}
PolygonStyles def_p {
-label Faces
-tip STYLES_POLYGON_TIP
}
MarkerSymbols def_m {
-label Markers
-tip STYLES_MARKER_TIP
}
}
}
GuidoLabel label1 {
-height 1.1
-label "Custom Styles"
-font_style bold
}
GuidoScrollPane sp {
-height 19
GuidoTable t {
-instances 1 1 30
-interactive true
-blank_row_headings true
-column_sorting false
GuidoField range {
-label Range
-display_length 8
-format range
-tip STYLES_RANGE_TIP
}
GuidoField stringLabel {
-display_length 8
-label Label
-tip STYLES_LABEL_TIP
}
StringLineStyles s {
-label Edges
-tip STYLES_STRING_TIP
}
PolygonStyles p {
-label Faces
-tip STYLES_POLYGON_TIP
}
MarkerSymbols m {
-label Markers
-tip STYLES_MARKER_TIP
}
}
}
GuidoPanel buffer_styles_file_panel {
-layout FlowLayout LEFT
GuidoCheckBox save_now {
-default false
-label "Save styles when form is applied?"
-selected_value Y
-tip "The styles can be saved to a styles file when the form is applied."
-unselected_value N
-next_focus styles_file
}
}
GuidoPanel hidden_styles_file_panel {
-layout FlowLayout LEFT
-dependency {"[ $save_now getCurrentValue]" == "Y"}
GuidoFileBrowserField styles_file {
-label Filename
-dependency {"[ $save_now getCurrentValue]" == "Y"}
-display_length 32
-file_mask *.ssi
-format none
-max_length 256
-translate lower
-tip "00337_TIP_002"
-file_access write
}
}
}
$frm00337 legacyProcessValues false
-next_focus def_stringLabel
}
