diff options
author | Andrej Shadura <andrewsh@debian.org> | 2018-05-08 15:59:31 +0200 |
---|---|---|
committer | Andrej Shadura <andrewsh@debian.org> | 2018-05-08 15:59:31 +0200 |
commit | 47aa8b00b2b11df13a100489e0f904a4947177ef (patch) | |
tree | b35c9acc778ea2f761f3c549f7bee2f4491b3144 /lib/bottompanel/calculator.tcl | |
parent | 5b8466f7fae0e071c0f4eda13051c93313910028 (diff) |
Import Upstream version 1.4.7
Diffstat (limited to 'lib/bottompanel/calculator.tcl')
-rw-r--r--[-rwxr-xr-x] | lib/bottompanel/calculator.tcl | 291 |
1 files changed, 177 insertions, 114 deletions
diff --git a/lib/bottompanel/calculator.tcl b/lib/bottompanel/calculator.tcl index 5196b40..b7ab722 100755..100644 --- a/lib/bottompanel/calculator.tcl +++ b/lib/bottompanel/calculator.tcl @@ -2,7 +2,7 @@ # Part of MCU 8051 IDE ( http://mcu8051ide.sf.net ) ############################################################################ -# Copyright (C) 2007-2009 by Martin Ošmera # +# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 by Martin Ošmera # # martin.osmera@gmail.com # # # # This program is free software; you can redistribute it and#or modify # @@ -21,6 +21,11 @@ # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # ############################################################################ +# >>> File inclusion guard +if { ! [ info exists _CALCULATOR_TCL ] } { +set _CALCULATOR_TCL _ +# <<< File inclusion guard + # -------------------------------------------------------------------------- # DESCRIPTION # @@ -28,12 +33,12 @@ class Calculator { - common count 0 ;# counter of instances + common calc_count 0 ;# counter of instances # Font for numerical keypad - common large_font [font create \ - -family {helveticat} \ - -size -12 \ - -weight {bold} \ + common large_font [font create \ + -family {helveticat} \ + -size [expr {int(-12 * $::font_size_factor)}] \ + -weight {bold} \ ] common oper_fg_color {#0000FF} ;# Foreground color for operator display @@ -44,7 +49,7 @@ class Calculator { # Variables related to object initialization private variable parent ;# Teportary variable -- GUI parent private variable calculatorList ;# Teportary variable -- COnfiguration list - private variable gui_initialized 0 ;# Bool: GUI created + private variable calc_gui_initialized 0 ;# Bool: GUI created # GUI variables private variable calc_num_keypad ;# Container of left side of calc. (keypad) @@ -138,11 +143,11 @@ class Calculator { {{ASin} {AS} {calc_opr ASin 1} {} {} {Arc sine} {5} {} {} {Calculator_RED} {#FFDDDD} 0 - {Arc sine. Argument should be in the range \[-1,1\].}} + {Arc sine. Argument should be in the range [-1,1].}} {{ACos} {AC} {calc_opr ACos 1} {} {} {Arc cosine} {5} {} {} {Calculator_RED} {#FFDDDD} 0 - {Arc cosine. Argument should be in the range \[-1,1\].}} + {Arc cosine. Argument should be in the range [-1,1].}} {{ATan} {AT} {calc_opr ATan 1} {} {} {Arc tangent} {5} {} {} {Calculator_RED} {#FFDDDD} 0 @@ -226,8 +231,8 @@ class Calculator { ## object constructor constructor {} { # Initialize some variables - incr count ;# Instance counter - set calc_idx $count ;# Index of this object + incr calc_count ;# Instance counter + set calc_idx $calc_count;# Index of this object set base Dec ;# Default numeric base set angle rad ;# Default angle unit set last_base $base ;# Last numeric base @@ -263,7 +268,7 @@ class Calculator { ttk::style configure Calculator_GRAY.TButton -padding 2 ttk::style map Calculator_GRAY.TButton \ - -background [list active {#DDDDDD} {!active !disabled} {#F8F8F8} disabled {#EEEEEE}] + -background [list active {#DDDDDD} {!active !disabled} {#F8F8F8} disabled ${::COMMON_BG_COLOR}] ttk::style configure Calculator_PURPLE.TButton -padding 2 -font $large_font ttk::style map Calculator_PURPLE.TButton \ @@ -460,9 +465,9 @@ class Calculator { set calc_mem [string range $calc_mem 0 {end-2}] } set ::Calculator::calc_mem${cell}_$calc_idx $calc_mem - } { + } else { # Load memory content into main display - set calc_display [subst "\$::Calculator::calc_mem${cell}_$calc_idx"] + set calc_display [subst -nocommands "\$::Calculator::calc_mem${cell}_$calc_idx"] rewrite_display } } @@ -490,7 +495,7 @@ class Calculator { $calc_oper == {pow} || $calc_oper == {mod} || $calc_oper == {and} || $calc_oper == {or} || $calc_oper == {xor} || $calc_oper == {nand} - } { + } then { # Check display value length if {$display == {}} { Sbar [mc "Calculator: Unable to evaluate, missing argument"] @@ -603,8 +608,8 @@ class Calculator { set calc_display [expr {tan($calc_buffer)}] } } - }]} { - # If error occured -> show error message + }]} then { + # If error occurred -> show error message Sbar [mc "Calculator: ERROR (result value is out of allowed range)"] return } @@ -727,25 +732,25 @@ class Calculator { # Determinate what memory cells aren't empty for {set i 0} {$i < 3} {incr i} { - set mem [[subst "\$mem_entry_$i"] get] + set mem [[subst -nocommands "\$mem_entry_$i"] get] if {[string index $mem end] == {.}} { append mem 0 } set memory$i $mem if {$mem == {} || $mem == 0} { set mem$i 0 - } { + } else { set mem$i 1 } } # Convert all non empty displays - foreach cnd "$dis $buf $mem0 $mem1 $mem2" \ + foreach cnd [list $dis $buf $mem0 $mem1 $mem2] \ var {calc_display calc_buffer memory0 memory1 memory2} { if {$cnd} { if {[catch { - set $var [$command [subst "\$$var"]] - }]} { + set $var [$command [subst -nocommands "\$$var"]] + }]} then { Sbar [mc "Calculator: Value is too high to convert, value deleted !"] set $var 0 } @@ -754,8 +759,8 @@ class Calculator { # Display new content of memory cells for {set i 0} {$i < 3} {incr i} { - [subst "\$mem_entry_$i"] delete 0 end - [subst "\$mem_entry_$i"] insert end [subst "\$memory$i"] + [subst -nocommands "\$mem_entry_$i"] delete 0 end + [subst -nocommands "\$mem_entry_$i"] insert end [subst -nocommands "\$memory$i"] } } @@ -764,7 +769,7 @@ class Calculator { public method cal_switchBase {} { # Get chosen value - set base [subst "\$::Calculator::calc_base$calc_idx"] + set base [subst -nocommands "\$::Calculator::calc_base$calc_idx"] # Convert display content to setected numeric system if {$base == $last_base} { @@ -852,32 +857,70 @@ class Calculator { public method cal_switchAngle {} { # Get chosen unit - set angle [subst "\$::Calculator::calc_angle$calc_idx"] + set angle [subst -nocommands "\$::Calculator::calc_angle$calc_idx"] # Convert all displays - if {$angle != $last_angle} { - # Convert display if is not empty - if {[read_display_inDec] != {}} { - write_display_inXbase [Angle::${last_angle}2${angle} $calc_display] + if {$angle == $last_angle} { + set last_angle $angle + return + } + + # Convert display if is not empty + if {[read_display_inDec] != {}} { + write_display_inXbase [Angle::${last_angle}2${angle} $calc_display] + } + + # Convert buffer if is not empty + if {[read_buffer_inDec] != {}} { + write_buffer_inXbase [Angle::${last_angle}2${angle} $calc_buffer] + } + + # Conver memory cells + for {set i 0} {$i <3} {incr i} { + # Get memory cell value + set mem [[subst -nocommands "\$mem_entry_$i"] get] + + # Convert to decimal value + if {$base != {Dec}} { + switch -- $base { + {Hex} { ;# from Hexadecimal + set mem [NumSystem::hex2dec $mem] + } + {Oct} { ;# from Octal + set mem [NumSystem::oct2dec $mem] + } + {Bin} { ;# from Binary + set mem [NumSystem::bin2dec $mem] + } + } } - # Convert buffer if is not empty - if {[read_buffer_inDec] != {}} { - write_buffer_inXbase [Angle::${last_angle}2${angle} $calc_buffer] + + # Adjust that value + if {[string index $mem end] == {.}} { + append mem 0 } - # Conver memory cells - for {set i 0} {$i <3} {incr i} { - # Get memory cell value - set mem [[subst "\$mem_entry_$i"] get] - # Adjust that value - if {[string index $mem end] == {.}} { - append mem 0 - } - # Display new value - if {$mem != {}} { - set mem [Angle::${last_angle}2${angle} $mem] - [subst "\$mem_entry_$i"] delete 0 end - [subst "\$mem_entry_$i"] insert end $mem + + # Display new value + if {$mem != {}} { + set mem [Angle::${last_angle}2${angle} $mem] + + # Convert to back from decimal value + if {$base != {Dec}} { + switch -- $base { + {Hex} { ;# to Hexadecimal + set mem [NumSystem::dec2hex $mem] + } + {Oct} { ;# to Octal + set mem [NumSystem::dec2oct $mem] + } + {Bin} { ;# to Binary + set mem [NumSystem::dec2bin $mem] + } + } } + + [subst -nocommands "\$mem_entry_$i"] delete 0 end + [subst -nocommands "\$mem_entry_$i"] insert end $mem } } @@ -920,7 +963,7 @@ class Calculator { {Hex} { ;# to Hexadecimal if {[catch { set calc_display [NumSystem::dec2hex $dec_content] - }]} { + }]} then { Sbar [mc "Calculator: ERROR, result is too high (cannot be displayed)"] set calc_display 0 } @@ -928,7 +971,7 @@ class Calculator { {Oct} { ;# to Octal if {[catch { set calc_display [NumSystem::dec2oct $dec_content] - }]} { + }]} then { Sbar [mc "Calculator: ERROR, result is too high (cannot be displayed)"] set calc_display 0 } @@ -936,14 +979,14 @@ class Calculator { {Bin} { ;# to Binary if {[catch { set calc_display [NumSystem::dec2bin $dec_content] - }]} { + }]} then { Sbar [mc "Calculator: ERROR, result is too high (cannot be displayed)"] set calc_display 0 } } } # If selected numeric base is Dec -> do nothing - } { + } else { set calc_display $dec_content } @@ -986,7 +1029,7 @@ class Calculator { {Hex} { ;# to Hexadecimal if {[catch { set calc_buffer [NumSystem::dec2hex $dec_content] - }]} { + }]} then { Sbar [mc "Calculator: ERROR, value is too high"] set calc_buffer 0 } @@ -994,7 +1037,7 @@ class Calculator { {Oct} { ;# to Octal if {[catch { set calc_buffer [NumSystem::dec2oct $dec_content] - }]} { + }]} then { Sbar [mc "Calculator: ERROR, value is too high"] set calc_buffer 0 } @@ -1002,14 +1045,14 @@ class Calculator { {Bin} { ;# to Binary if {[catch { set calc_buffer [NumSystem::dec2bin $dec_content] - }]} { + }]} then { Sbar [mc "Calculator: ERROR, value is too high"] set calc_buffer 0 } } } # If selected numeric base is Dec -> do nothing - } { + } else { set calc_buffer $dec_content } @@ -1040,16 +1083,16 @@ class Calculator { } ## Read true content of main display widget converted - # @parm args = False - adjust to float + # @parm args atf=0 - do not adjust to float # @return Float - content of the main display - private method reread_display args { + private method reread_display {{atf 0}} { # Get content of the widget set calc_display [$calc_display_widget get] regsub {\,} $calc_display {.} calc_display - # Adhust to float (if requested) - if {$args != 1} { + # Adjust to float (if requested) + if {!$atf} { if {[regexp {^\.} $calc_display]} { set calc_display "0$calc_display" } elseif {[regexp {\.$} $calc_display]} { @@ -1106,7 +1149,7 @@ class Calculator { if {$angle == {grad}} { set dec_angle [Angle::grad2rad $dec_angle] # From degrees - } { + } else { set dec_angle [Angle::deg2rad $dec_angle] } } @@ -1124,7 +1167,7 @@ class Calculator { if {$angle == {grad}} { set dec_angle [Angle::rad2grad $dec_angle] # To degrees - } { + } else { set dec_angle [Angle::rad2deg $dec_angle] } } @@ -1183,7 +1226,7 @@ class Calculator { $widget configure -style Calculator_Error.TEntry } return 1 - } { + } else { Sbar [mc "Calculator: Trying to insert invalid value"] return 0 } @@ -1243,10 +1286,10 @@ class Calculator { return # Negate value - } { + } else { if {[regexp {^\-} $calc_display]} { set calc_display [string range $calc_display 1 end] - } { + } else { set calc_display "-$calc_display" } } @@ -1262,7 +1305,7 @@ class Calculator { public method PrepareCalculator {_parent _calculatorList} { set parent $_parent set calculatorList $_calculatorList - set gui_initialized 0 + set calc_gui_initialized 0 } ## Inform this tab than it has became active @@ -1271,13 +1314,20 @@ class Calculator { $calc_display_widget selection range 0 end $calc_display_widget icursor end focus $calc_display_widget + + update idletasks + $scrollable_frame yview scroll 0 units } ## Initialize calculator GUI # @return void public method CreateCalculatorGUI {} { - if {$gui_initialized} {return} - set gui_initialized 1 + if {$calc_gui_initialized} {return} + set calc_gui_initialized 1 + + if {${::DEBUG}} { + puts "CreateCalculatorGUI \[ENTER\]" + } # Create scrollable area set scrollable_frame [ScrollableFrame $parent.scrollable_frame \ @@ -1307,7 +1357,7 @@ class Calculator { set calc_buffer_widget [ttk::entry $frame0.calc_buffer \ -textvariable ::Calculator::calc_buffer$calc_idx \ -validate key \ - -validatecommand "$this calc_validate %W %P" \ + -validatecommand [list $this calc_validate %W %P] \ -width 13 \ -style Calculator_Buffer.TEntry \ ] @@ -1319,7 +1369,7 @@ class Calculator { -textvariable ::Calculator::calc_oper$calc_idx \ -validate all \ -width 3 \ - -validatecommand "$this calc_oper_validate %P" \ + -validatecommand [list $this calc_oper_validate %P] \ -style Calculator_Oper.TEntry \ ] DynamicHelp::add $frame0.calc_oper -text [mc "Selected operation"] @@ -1329,7 +1379,7 @@ class Calculator { set calc_display_widget [ttk::entry $frame0.calc_displ \ -textvariable ::Calculator::calc_displ$calc_idx \ -validate key \ - -validatecommand "$this calc_validate %W %P" \ + -validatecommand [list $this calc_validate %W %P] \ -width 13 \ -style Calculator_Display.TEntry \ ] @@ -1341,12 +1391,12 @@ class Calculator { pack $calc_oper_widget -side left pack $calc_display_widget -side left # Create binding for displays - bind $calc_buffer_widget <KP_Enter> "$this calc_Evaluate" - bind $calc_oper_widget <KP_Enter> "$this calc_Evaluate" - bind $calc_display_widget <KP_Enter> "$this calc_Evaluate" - bind $calc_buffer_widget <Return> "$this calc_Evaluate" - bind $calc_oper_widget <Return> "$this calc_Evaluate" - bind $calc_display_widget <Return> "$this calc_Evaluate" + bind $calc_buffer_widget <KP_Enter> [list $this calc_Evaluate] + bind $calc_oper_widget <KP_Enter> [list $this calc_Evaluate] + bind $calc_display_widget <KP_Enter> [list $this calc_Evaluate] + bind $calc_buffer_widget <Return> [list $this calc_Evaluate] + bind $calc_oper_widget <Return> [list $this calc_Evaluate] + bind $calc_display_widget <Return> [list $this calc_Evaluate] ## Create: numeric base and angle unit switch + CA + C @@ -1357,7 +1407,7 @@ class Calculator { -values {Hex Dec Oct Bin} \ -textvariable ::Calculator::calc_base$calc_idx \ -width 4 \ - ] -side left + ] -side left -padx 2 bind $frame1.lf.calc_base_CB <<ComboboxSelected>> "$this cal_switchBase" DynamicHelp::add $frame1.lf.calc_base_CB -text [mc "Numeric base"] setStatusTip -widget $frame1.lf.calc_base_CB \ @@ -1368,7 +1418,7 @@ class Calculator { -values {rad deg grad} \ -textvariable ::Calculator::calc_angle$calc_idx \ -width 4 \ - ] -side left + ] -side left -padx 2 bind $frame1.lf.calc_angle_CB <<ComboboxSelected>> "$this cal_switchAngle" DynamicHelp::add $frame1.lf.calc_angle_CB -text [mc "Angle unit"] setStatusTip -widget $frame1.lf.calc_angle_CB \ @@ -1379,9 +1429,9 @@ class Calculator { # Button "Clear" pack [ttk::button $frame1.rf.calc_Clear \ -text {C} \ - -command "$this calc_Clear" \ + -command [list $this calc_Clear] \ -width 3 \ - ] -side left + ] -side left -padx 2 DynamicHelp::add $frame1.rf.calc_Clear \ -text [mc "Clear both displays"] setStatusTip -widget $frame1.rf.calc_Clear \ @@ -1389,9 +1439,9 @@ class Calculator { # Button "Clear actual" pack [ttk::button $frame1.rf.calc_Clear_act \ -text {CA} \ - -command "$this calc_ClearActual" \ + -command [list $this calc_ClearActual] \ -width 3 \ - ] -side left + ] -side left -padx 2 DynamicHelp::add $frame1.rf.calc_Clear_act \ -text [mc "Clear main display"] setStatusTip -widget $frame1.rf.calc_Clear_act \ @@ -1399,9 +1449,9 @@ class Calculator { # Button "Negate" pack [ttk::button $frame1.rf.calc_Negate_dis \ -text {+/-} \ - -command "$this calc_NegateDis" \ + -command [list $this calc_NegateDis] \ -width 3 \ - ] -side left + ] -side left -padx 2 DynamicHelp::add $frame1.rf.calc_Negate_dis \ -text [mc "Negate value in main display"] setStatusTip -widget $frame1.rf.calc_Negate_dis \ @@ -1422,7 +1472,7 @@ class Calculator { set entry [ttk::entry $frame_id.calc_mem_entry_${i} \ -textvariable ::Calculator::calc_mem${i}_${calc_idx} \ -validate all \ - -validatecommand "$this calc_validate %W %P" \ + -validatecommand [list $this calc_validate %W %P] \ ] DynamicHelp::add $frame_id.calc_mem_entry_${i} -text [mc "Memory bank %s" $i] pack $entry -side left @@ -1433,7 +1483,7 @@ class Calculator { -text [mc "Save"] \ -command "$this mem Save $i" \ -width 5 \ - ] -side left + ] -side left -padx 2 -pady 2 DynamicHelp::add $frame_id.calc_mem_save_button_${i} \ -text [mc "Save content of main display to this memory bank %s" $i] setStatusTip -widget $frame_id.calc_mem_save_button_${i} \ @@ -1443,7 +1493,7 @@ class Calculator { -text [mc "Load"] \ -command "$this mem Load $i" \ -width 5 \ - ] -side left + ] -side left -padx 2 -pady 2 DynamicHelp::add $frame_id.calc_mem_load_button_${i} \ -text [mc "Load content of this bank into main display"] setStatusTip -widget $frame_id.calc_mem_load_button_${i} \ @@ -1475,7 +1525,7 @@ class Calculator { for {set i 0} {$i < 5} {incr i} { if {$i == 1} { pack $calc_num_display.calc_num_display${i} -pady 10 - } { + } else { pack $calc_num_display.calc_num_display${i} } } @@ -1491,7 +1541,7 @@ class Calculator { if { $base != {Hex} && $base != {Dec} && $base != {Oct} && $base != {Bin} - } { + } then { set base [lindex ${X::project_edit_defaults} {3 1}] puts stderr [mc "Invalid numerical base: '%s'" $base] } @@ -1553,14 +1603,14 @@ class Calculator { ## Get calculator list for later initialization # @return List - resulting list of values public method get_calculator_list {} { - if {!$gui_initialized} {CreateCalculatorGUI} + if {!$calc_gui_initialized} {CreateCalculatorGUI} return [list $base $angle \ [$calc_display_widget get] \ $calc_oper \ [$calc_buffer_widget get] \ - [subst "\$::Calculator::calc_mem0_$calc_idx"] \ - [subst "\$::Calculator::calc_mem1_$calc_idx"] \ - [subst "\$::Calculator::calc_mem2_$calc_idx"] \ + [subst -nocommands "\$::Calculator::calc_mem0_$calc_idx"] \ + [subst -nocommands "\$::Calculator::calc_mem1_$calc_idx"] \ + [subst -nocommands "\$::Calculator::calc_mem2_$calc_idx"] \ [$timerscalc_freq_entry get] \ [$timerscalc_time_entry get] \ [$timerscalc_mode_spinbox get]] @@ -1574,8 +1624,14 @@ class Calculator { if {$timerscalc_validation_dis} { return 1 } + + # Ignore empty value + if {$content == {}} { + return 1 + } + # If content is decimal number (max 5. digits) -> evaluate and return True - if {[regexp {^\d*$} $content] && ([string length $content] < 6)} { + if {[regexp {^\d+(\.\d*)?$} $content] && ([string length $content] < 9)} { calc_timerscalc_evaluate \ $content \ [$timerscalc_time_entry get] \ @@ -1601,7 +1657,7 @@ class Calculator { if {$content > 2} { return 0 } - calc_timerscalc_evaluate \ + calc_timerscalc_evaluate \ [$timerscalc_freq_entry get] \ [$timerscalc_time_entry get] \ $content @@ -1659,7 +1715,7 @@ class Calculator { foreach widget $widgets { $widget configure -state normal } - } { + } else { foreach widget $widgets { $widget configure -state disabled } @@ -1679,12 +1735,15 @@ class Calculator { set repeat 0 set correction 0 + # Remove leading dot from the frequency value + set freq [string trimright $freq {.}] + # Check for validity of given values if {$freq == {} || $freq == 0 || $time == {} || $mode == {} } { set mode {invalid} - } { + } else { # Compute time in machine cycles - set time [expr {int($time * (12000.0 / $freq))}] + set time [expr {int($time * ($freq / 12000.0))}] } # Perform computation for the given mode @@ -1696,7 +1755,7 @@ class Calculator { if {[expr {!($time & 0x1FFF)}]} { incr repeat -1 set stepsPerIter 0x1FFF - } { + } else { set stepsPerIter [expr {$time / $repeat}] set tmp [expr {0x2000 - $stepsPerIter}] set TLx [expr {$tmp & 0x1F}] @@ -1711,7 +1770,7 @@ class Calculator { if {[expr {!($time & 0xFFFF)}]} { incr repeat -1 set stepsPerIter 0xFFFF - } { + } else { set stepsPerIter [expr {$time / $repeat}] set tmp [expr {0x10000 - $stepsPerIter}] set TLx [expr {$tmp & 0xFF}] @@ -1726,7 +1785,7 @@ class Calculator { if {[expr {!($time & 0xFF)}]} { incr repeat -1 set stepsPerIter 0xFF - } { + } else { set stepsPerIter [expr {$time / $repeat}] set TLx [expr {0x100 - $stepsPerIter}] set THx $TLx @@ -1756,16 +1815,16 @@ class Calculator { # Check for allowed length of results (string representation) if { - [string length [format "%o" $repeat]] > 6 - || - [string length [format "%o" $correction]] > 6 - } { - set TLx 0 - set THx 0 - set repeat 0 - set correction 0 - calc_timerscalc_highlight 0 - Sbar [mc "Calculator: Unable to evaluate, result value is too high"] + [string length [format "%o" $repeat]] > 6 + || + [string length [format "%o" $correction]] > 6 + } then { + set TLx 0 + set THx 0 + set repeat 0 + set correction 0 + calc_timerscalc_highlight 0 + Sbar [mc "Calculator: Unable to evaluate, result value is too high"] } ## Write results @@ -1810,11 +1869,11 @@ class Calculator { grid [label $top_frame.calc_timerscalc_mode_label \ -text [mc "Mode"] \ ] -row 0 -column 2 -sticky w - set timerscalc_mode_spinbox [spinbox \ + set timerscalc_mode_spinbox [ttk::spinbox \ $top_frame.calc_timerscalc_mode_spinbox \ - -bg {#FFFFFF} -highlightthickness 0 \ -from 0 -to 2 -width 1 -validate key \ - -vcmd "$this calc_timerscalc_mode_validate %P" \ + -validatecommand "$this calc_timerscalc_mode_validate %P" \ + -command "$this calc_timerscalc_mode_validate \[$top_frame.calc_timerscalc_mode_spinbox get\]" ] grid $timerscalc_mode_spinbox -row 0 -column 3 -sticky we # time @@ -2060,7 +2119,7 @@ class Calculator { update } # Show scrollbar - } { + } else { if {![winfo ismapped $horizontal_scrollbar]} { pack $horizontal_scrollbar -fill x -side top -before $scrollable_frame } @@ -2069,3 +2128,7 @@ class Calculator { } } } + +# >>> File inclusion guard +} +# <<< File inclusion guard |