proc change_file_exts { pluginCombo ExtsCombo } {
set plugin [ $pluginCombo getCurrentValue ]
if { [string length $plugin] > 0 } {
set buffer [ GuidoExecServer getPluginExtsByFriendlyName [ subst { pluginFriendlyName = "$plugin" } ] ]
set numExts [ GuidoGetParamBufferValue $buffer "numPluginExts" ]
set exts [ GuidoGetParamBufferValue $buffer pluginExts ]
set values ""
for {set i 0} {$i < $numExts} {incr i} {
set extension [lindex $exts $i]
if {$extension != ".*"} {
lappend values $extension
}
}
eval [concat {$ExtsCombo} {setValues} $values ]
}
}
proc correctInitialExtension { outputExt } {
$outputExt setExclusive true
}
proc validatestylesFileName { saveStyleFileName } {
set stylefileName [$saveStyleFileName getCurrentValue]
if {[string match {*,*} $stylefileName] != 0 } {
GuidoMessage warning COMMA_NOT_ALLOWED_IN_FILENAME $stylefileName
return 0
} else {
return 1
}
}
proc saveStylesOpts { output_type saveStyle layerName} {
set buffer [GuidoExecServer GetLayerFileName {}]
set layerFName [GuidoGetParamBufferValue $buffer FileName]
set Layer [$layerName getCurrentValue]
set cache [GuidoExecServer GetFileFormat [subst {sessionType = "$Layer"}]]
set format [GuidoGetParamBufferValue $cache FileFormat]
set stylestatus [GuidoExecServer isStylesVerChanged [subst {sessionType = "$Layer"}]]
set Style [GuidoGetParamBufferValue $stylestatus VersionStatus]
$saveStyle setSelected false
$saveStyle setInputAllowed false
set outputType [$output_type getCurrentValue]
if { "$outputType" == "Surpac String Files" || "$outputType" == "Surpac DTM Files" } {
if { $Style == 1 } {
if { "[string range $format 0 14]" == "microstationdgn" || "[string range $format 0 6]" == "Autocad" } {
$saveStyle setCurrentValue "Y"
$saveStyle setInputAllowed true
} else {
$saveStyle setCurrentValue "N"
$saveStyle setInputAllowed true
}
} else {
$saveStyle setCurrentValue "N"
$saveStyle setInputAllowed true
}
}
}
GuidoForm FileSaveAs {
-default_buttons
-label SAVE_FILE_AS
-layout BoxLayout Y_AXIS
-help_id 1116
GuidoPanel files {
-layout BoxLayout Y_AXIS
GuidoPanel layerPanel {
-layout CentreLineLayout
GuidoLabel labelLayer {
-label "Layer Name"
-height 1
}
GuidoLabel layerName {
-font_highlight 0 0 255
-height 1
}
GuidoFileBrowserField output_file {
-label SAVE_OUTPUT_FILE
-display_length 30
-format none
-file_access write
-link  "" output_type
-file_extension_field outputExt
-max_length FIO_MAX_FILENAME_LENGTH
-null false
-extension false
-tip SAVE_FILE_NAME_TIP
}
GuidoComboBox output_type {
-label CONVERT_OUTPUT_TYPE
-display_length 28
-format none
-max_length FIO_MAX_FILENAME_LENGTH
-null false
-tip CONVERT_FILE_TYPE_TIP
}
GuidoComboBox outputExt {
-label SAVE_FILE_EXTENSION
-display_length 6
-format none
-max_length FIO_MAX_FILENAME_LENGTH
-exclusive false
-null false
-tip CONVERT_FILE_TYPE_TIP
}
}
}
GuidoFiller space {
-height 0.5
}
GuidoPanel pluginOptions {
-border etched true
-label "Options..."
-layout OverlayLayout
GuidoScript scripts/pluginOptionsSave.tcl
}
GuidoScript scripts/pluginOptionsSaveBeforeForm.tcl
GuidoFiller space {
-height 0.5
}
GuidoPanel saveStyleOptions {
-layout CentreLineLayout
GuidoCheckBox saveStyle {
-default true
-font_style bold
-label "Save styles"
-selected_value Y
-tip "SAVE_STYLES_FIELD_TIP"
-unselected_value N
-next_focus saveStyleFileName
}
GuidoFileBrowserField saveStyleFileName {
-validation {[validatestylesFileName $saveStyleFileName]}
-dependency {"[ $saveStyle getCurrentValue]" == "Y"}
-display_length 30
-font_style bold
-null false
-input false
-format none
-label "Styles file name"
-max_length FIO_MAX_FILENAME_LENGTH
-tip "SAVE_STYLES_FIELD_TIP"
}
}
$saveStyleOptions setActionCallback initial { [saveStylesOpts $output_type  $saveStyle $layerName] }
$output_type setActionCallback valueChanged { [change_file_exts $output_type $outputExt] }
$output_type setActionCallback valueChanged { [saveStylesOpts $output_type $saveStyle $layerName] }
-action initial { [correctInitialExtension $outputExt] }
}
