lappend argv "nonNavigatorOperation"
global inFiles
global outputfilename
global label3
set fileList [lindex $argv 0]
if { $fileList == "nonNavigatorOperation" } {
set fileList ""
set navigatorOp false
} else {
set argc [llength $argv]
for {set i 1} {$i < $argc - 1} {incr i} {
append fileList " "
append fileList [lindex $argv $i]
}
set navigatorOp true
}
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 validate_infile_entered { } {
global inFiles
global outputfilename
set delimiter ";"
set value [$inFiles getCurrentValue]
if {[string first $delimiter $value] != -1} {
$outputfilename setCurrentValue ""
$outputfilename setVisible false
} else {
$outputfilename setVisible true
}
}
proc showfield { } {
global outputfilename
$outputfilename setVisible true
}
set show 1
set index 0
set values ""
set alternate_values ""
set num -1
GuidoForm FileConverting {
-default_buttons
-help_id 203
-label CONVERT_FILE_FORMAT
-defaults_management true
GuidoPanel files {
-layout BoxLayout Y_AXIS
GuidoFiller space {
-height 0.5
}
GuidoPanel p2 {
-layout CentreLineLayout
GuidoLabel label1 {
-label CONVERT_INPUT_FILES
-display_length 10
if { $navigatorOp } {
-visible false
}
}
GuidoFileBrowserField inFiles {
-display_length 30
-format none
-file_access read
-file_mask "str_plugins obj_plugins"
-tip CONVERT_FILE_NAME_TIP
-multiple_selection "true"
-default $fileList
-action focusGained {[showfield]}
-action focusLost {[validate_infile_entered]}
if { $navigatorOp } {
-visible false
-null true
} else {
-null false
}
}
}
GuidoPanel p6 {
-layout CentreLineLayout
GuidoLabel label3 {
-label "Output file name"
-display_length 10
if { $navigatorOp } {
-visible false
}
}
GuidoFileBrowserField outputfilename {
-display_length 30
-format none
-null false
-max_length 256
-tip CONVERT_FILE_NAME_TIP_1
if { $navigatorOp } {
-visible false
-null true
} else {
-null false
}
}
}
GuidoPanel p3 {
-layout CentreLineLayout
GuidoLabel label2 {
-label CONVERT_OUTPUT_TYPE
-display_length 10
}
GuidoComboBox output_type {
-display_length 28
-format none
-max_length 256
-null false
-action valueChanged { [change_file_exts $output_type $outputExt] }
-tip CONVERT_FILE_TYPE_TIP
}
}
GuidoPanel p4 {
-layout CentreLineLayout
GuidoLabel label2 {
-label SAVE_FILE_EXTENSION
-display_length 10
}
GuidoComboBox outputExt {
-display_length 6
-format none
-max_length 256
-null false
-tip CONVERT_FILE_TYPE_TIP
}
}
GuidoFiller space {
-height 0.5
}
GuidoPanel p5 {
-layout CentreLineLayout VERTICAL LEFT
GuidoCheckBox showOverwriteWarnings {
-label SHOW_OVERWRITE_WARNING
-selected_value Y
-unselected_value N
-default Y
-tip OVERWRITE_WARNING_ENABLE_TIP
}
GuidoCheckBox logFile {
-label CONVERT_FILE_LOG_FILE_LABEL
-selected_value "on"
-unselected_value "off"
-default "off"
-tip CONVERT_FILE_LOG_FILE_TIP
}
GuidoFileBrowserField logFilename {
-label CONVERT_FILE_LOG_FILENAME_LABEL
-dependency { "[$logFile getCurrentValue]" == "on" }
-default "convert_files_log.txt"
-display_length 25
-max_length 128
-input allowed
-translate none
-format none
-absolutePath
-tip CONVERT_FILE_LOG_FILENAME_TIP
}
}
GuidoFiller space {
-height 0.5
}
GuidoPanel pluginOptions {
-border etched true
-label "Plugin Options..."
-layout OverlayLayout
GuidoScript scripts/pluginOptionsSave.tcl
}
}
}
set buffer [ GuidoExecServer getWriterPluginsFriendlyName {} ]
set numFormats [ GuidoGetParamBufferValue $buffer numWriterPlugins ]
set formats [ GuidoGetParamBufferValue $buffer writerPluginNames ]
set displayformats [ GuidoGetParamBufferValue $buffer writerPluginDisplayNames ]
for {set index 0} {$index < $numFormats} {incr index} {
set type [lindex $formats $index]
lappend values $type
set displaytype [lindex $displayformats $index]
lappend alternate_values $displaytype
}
eval [concat {$output_type} {setValues} $values ]
eval [concat {$output_type} {setAlternativeValues} $alternate_values ]
change_file_exts $output_type $outputExt
GuidoScript scripts/pluginOptionsSaveBeforeForm.tcl
if { $show } {
set return_code [$FileConverting interact]
if {$return_code == "apply"} {
GuidoApp app "CONVERT FILES"
$app setParam input_files [$inFiles getCurrentValue]
$app setParam output_file [$outputfilename getCurrentValue]
$app setParam append "NO"
$app setParam output_type [$output_type getCurrentValue]
$app setParam output_ext [$outputExt getCurrentValue]
if { [$logFile getCurrentValue] == "on" } {
$app setParam log_filename [$logFilename getCurrentValue]
}
$app setParam overwriteWarnings [$showOverwriteWarnings getCurrentValue]
GuidoScript scripts/pluginOptionsSaveAfterForm.tcl
set return_code [$app invoke]
$app destroy
}
}
$FileConverting destroy
