GuidoScript scripts/geologyutilities.tcl
proc collar_decimals_allowed {field_name dp} {
if {$field_name != ""} {
set buffer [GuidoExecServer GetFieldInformation [subst {DatabaseType = "GeologyDatabase" SurpacTableName = "collar" SurpacFieldName = $field_name}]]
set FieldType [GuidoGetParamBufferValue $buffer FieldType]
if {$FieldType == "real"} {
if {[$dp getCurrentValue] == ""} {
$dp setCurrentValue 2
}
return 1
}
$dp setCurrentValue ""
return 0
}
$dp setInputAllowed 0 false
return 0
}
global show_collars
global collar_marker
global collar_marker_size
global collar_position
global collar_offset
global collar_table
global collar_fld
global collar_decimals
global collar_font_style
global collar_font_size
global collar_font_units
global collar_label_position
GuidoPanel collar_panelb {
-layout BoxLayout Y_AXIS
GuidoPanel panel {
-layout CentreLineLayout
GuidoPanel panel2 {
-layout CentreLineLayout
GuidoCheckBox show_collars {
-default true
-font_style bold
-label "Display collar markers"
-selected_value true
-unselected_value false
-tip DB_COLLAR_LABELS_SHOW_TIP
}
GuidoComboBox collar_marker {
-dependency {"[ $show_collars getCurrentValue]" == "true"}
-label "Collar marker"
-display_length 2
-format none
-max_length 5
-tip DB_COLLAR_LABELS_MARKER_TIP
-value_in "" * + . O (*) (.) (+) (x) (O) \[\] \[*\] \[.\] \[x\] <> <*> <.> <+> /\\ /*\\ /.\\ |> |*> |.> <| <*| <.| \\/ \\*/ \\./ # ++ "/ \\" /_\\ /__\\ /_^_\\ | / \\
-default (+)
}
GuidoField collar_marker_size {
-dependency {"[ $show_collars getCurrentValue]" == "true"}
-label "Collar marker size"
-decimals 1
-display_length 5
-format double
-max_length 8
-null false
-tip DB_COLLAR_LABELS_MARKER_SIZE_TIP
-default 1.0
}
GuidoComboBox collar_position {
-label "Label orientation"
-display_length 6
-exclusive true
-null false
-max_length 13
-value_in centered "along path"
-default "centered"
-tip DB_COLLAR_LABELS_MARKER_POSITION_TIP
}
GuidoField collar_offset {
-label "Label offset"
-decimals 1
-display_length 5
-format double
-max_length 8
-null false
-tip DB_COLLAR_LABELS_OFFSET_TIP
-default 0.0
}
}
}
GuidoFiller attributes_filler_2 {
-height 0.5
}
GuidoPanel borderLayout {
-layout borderlayout
GuidoScrollPane scroller {
-width 45
-height 5
GuidoTable collar_table {
-instances 1 0 200
-interactive true "insert|remove|add"
-position centre
GuidoTableFieldBrowser collar_fld {
-display_length 5
-label "Field"
-format string
-exclusive true
-database dbHandle
-tip DB_COLLAR_LABELS_FLD_TIP
}
GuidoField collar_decimals {
-dependency {"[collar_decimals_allowed [$collar_fld getCurrentValue] $collar_decimals]"}
-label "Decimals"
-display_length 4
-format integer
-max_length 8
-null false
-tip DB_COLLAR_LABELS_DP_TIP
}
GuidoFontNameBrowser collar_font_style {
-label "Font"
-default Default
-display_length 8
-format none
-max_length 14
-tip DB_COLLAR_LABELS_FONT_TIP
}
GuidoField collar_font_size {
-label "Size"
-decimals 3
-display_length 3
-format double
-max_length 8
-null false
-default 1.0
-tip DB_FONT_SIZE_TIP
}
GuidoComboBox collar_font_units {
-label "Units"
-default oru
-display_length 1
-format none
-max_length 3
-null false
-value_in oru sru
-tip DB_FONT_SIZE_TIP
}
GuidoComboBox collar_label_position {
-label "Position"
-default collar
-display_length 6
-format none
-max_length 6
-null false
-value_in collar eoh
-tip DB_LABEL_POSITION_TIP
}
}
}
}
$collar_font_style updateBrowserList
}
$collar_panel add [eval "\$collar_panelb getObject"]
$collar_fld removeAllItems
$collar_fld setTableHandle "collar"
$collar_fld updateBrowserList
set databuf [ GuidoExecServer GetHoleCollars {} ]
set status [GuidoGetParamBufferValue $databuf status]
if {$status >= 0} {
$collar_marker      setCurrentValue [GuidoGetParamBufferValue $databuf "collar_marker"]
$collar_marker_size setCurrentValue [GuidoGetParamBufferValue $databuf "collar_marker_size"]
$show_collars       setCurrentValue [GuidoGetParamBufferValue $databuf "show_collars"]
$collar_position    setCurrentValue [GuidoGetParamBufferValue $databuf "position"]
$collar_offset      setCurrentValue [GuidoGetParamBufferValue $databuf "collar_offset"]
set num_rows [GuidoGetParamBufferValue $databuf "num_rows"]
if {$num_rows > 0} {
$collar_table setInitialRows $num_rows 0 200
} else {
$collar_decimals setInputAllowed 0 false
}
for {set i 0} {$i < $num_rows} {incr i} {
$collar_fld setCurrentValue $i [GuidoGetParamBufferValue $databuf "fld($i)"]
if {[GuidoGetParamBufferValue $databuf "decimals($i)"] != "-1"} {
$collar_decimals setCurrentValue $i [GuidoGetParamBufferValue $databuf "decimals($i)"]
}
$collar_font_style setCurrentValue $i [GuidoGetParamBufferValue $databuf "font_style($i)"]
$collar_font_size setCurrentValue $i [GuidoGetParamBufferValue $databuf "font_size($i)"]
$collar_font_units setCurrentValue $i [GuidoGetParamBufferValue $databuf "font_units($i)"]
$collar_label_position setCurrentValue $i [GuidoGetParamBufferValue $databuf "label_position($i)"]
}
}
