diff options
Diffstat (limited to 'lib/simulator/stackmonitor.tcl')
-rw-r--r--[-rwxr-xr-x] | lib/simulator/stackmonitor.tcl | 65 |
1 files changed, 38 insertions, 27 deletions
diff --git a/lib/simulator/stackmonitor.tcl b/lib/simulator/stackmonitor.tcl index 8f83ab2..b51fabb 100755..100644 --- a/lib/simulator/stackmonitor.tcl +++ b/lib/simulator/stackmonitor.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 _STACKMONITOR_TCL ] } { +set _STACKMONITOR_TCL _ +# <<< File inclusion guard + # -------------------------------------------------------------------------- # DESCRIPTION @@ -31,20 +36,20 @@ class StackMonitor { ## COMMON common push_value {} ;# String: Value to PUSH onto the stack by user - common count 0 ;# Int: Counter of intances + common stack_mon_count 0 ;# Int: Counter of intances common geometry ${::CONFIG(STACK_MON_GEOMETRY)} ;# Geometry: Last window geometry common collapsed ${::CONFIG(STACK_MON_COLLAPSED)};# Bool: Bottom bar hidden # Font for the text widget representing the stack (bold) - common font0 [font create \ - -family $::DEFAULT_FIXED_FONT \ - -size -12 \ - -weight bold \ + common font0 [font create \ + -family $::DEFAULT_FIXED_FONT \ + -size [expr {int(-12 * $::font_size_factor)}] \ + -weight bold \ ] # Font for the text widget representing the stack (normal) - common font1 [font create \ - -family $::DEFAULT_FIXED_FONT \ - -size -12 \ - -weight normal \ + common font1 [font create \ + -family $::DEFAULT_FIXED_FONT \ + -size [expr {int(-12 * $::font_size_factor)}] \ + -weight normal \ ] ## PRIVATE @@ -64,8 +69,8 @@ class StackMonitor { constructor {} { # Increment counter of object instances - incr count - set obj_idx $count + incr stack_mon_count + set obj_idx $stack_mon_count } destructor { @@ -84,8 +89,8 @@ class StackMonitor { set dialog_opened 1 # Create dialog window - set win [toplevel .stack_monitor$count -class {Interrupt monitor} -bg {#EEEEEE}] - incr count + set win [toplevel .stack_monitor${stack_mon_count} -class {Interrupt monitor} -bg ${::COMMON_BG_COLOR}] + incr stack_mon_count # Create window frames (main frame and status bar, etc.) set top_frame [frame $win.top_frame] @@ -106,19 +111,19 @@ class StackMonitor { -font $font0 -width 27 \ -justify left -anchor w -background {#DDDDDD} \ -bd 0 -text [mc "Addr HH Dec Binary Oct A"] \ - ] - pack $values_txt -fill y -expand 1 + ] -anchor w -fill x + pack $values_txt -fill both -expand 1 $values_txt tag configure tag_general -background {#CCCCFF} $values_txt tag configure tag_subprog -background {#CCFFCC} $values_txt tag configure tag_interrupt -background {#FFCCCC} bind $values_txt <ButtonRelease-3> {break} bind $values_txt <<Selection>> "false_selection $values_txt; break" # Scrollbar - pack $left_frame -side left -fill y -expand 1 + pack $left_frame -side left -fill both -expand 1 pack [ttk::scrollbar $top_frame.scrollbar \ -command "$values_txt yview" \ -orient vertical \ - ] -side right -fill y -expand 1 + ] -side right -fill y ## Stack pointer @@ -166,7 +171,7 @@ class StackMonitor { pack $col_exp_button -side right -padx 5 # Pack frames except for the bottom bar (with legend) - pack $top_frame -fill y -expand 1 + pack $top_frame -fill both -expand 1 pack $bottom_frame -anchor w -fill x ## Create bottom bar (with legend) @@ -178,7 +183,7 @@ class StackMonitor { pack [label $tool_frame.lf.sl1 -text [mc "Subprogram"] -font $font0 -bg {#CCFFCC}] -side left -fill y -padx 3 pack [label $tool_frame.lf.il1 -text [mc "Interrupt"] -font $font0 -bg {#FFCCCC}] -side left -fill y - # Show or keep the bottom bar hidden acording to previous session + # Show or keep the bottom bar hidden according to previous session if {!$collapsed} { set collapsed [expr {!$collapsed}] stack_monitor_col_exp @@ -187,7 +192,8 @@ class StackMonitor { # Set window attributes wm iconphoto $win ::ICONS::16::kcmmemory_ST - wm title $win [mc "Stack - %s - MCU 8051 IDE" [string trim $this {:}]] + wm title $win [mc "Stack - %s - MCU 8051 IDE" [$this cget -projectName]] + wm minsize $win 225 90 if {$geometry != {}} { wm geometry $win $geometry } @@ -313,7 +319,7 @@ class StackMonitor { if {$collapsed} { set image 2downarrow pack forget $tool_frame - } { + } else { set image 2uparrow pack $tool_frame -fill y -anchor nw } @@ -381,7 +387,7 @@ class StackMonitor { } # Create toplevel window - set dlg [toplevel .manual_push${obj_idx} -class {Push value onto stack} -bg {#EEEEEE}] + set dlg [toplevel .manual_push${obj_idx} -class {Push value onto stack} -bg ${::COMMON_BG_COLOR}] # Create label, entryBox and horizontal separator pack [label $dlg.lbl -text [mc "Push value onto stack (HEX)"]] -fill x -anchor w -padx 5 @@ -411,7 +417,7 @@ class StackMonitor { -compound left \ -image ::ICONS::16::down0 \ -command "$this stack_monitor_manual_push_val" \ - ] -side left + ] -side left -padx 2 pack [ttk::button $buttonFrame.cancel \ -width 5 \ -text [mc "Close"] \ @@ -420,18 +426,19 @@ class StackMonitor { -command " grab release $dlg destroy $dlg" \ - ] -side left + ] -side left -padx 2 pack $buttonFrame -side right -padx 5 # Set window attributes wm iconphoto $dlg ::ICONS::16::kcmmemory_ST wm title $dlg [mc "Push value onto stack."] wm minsize $dlg 200 60 + wm transient $dlg $win wm protocol $dlg WM_DELETE_WINDOW " grab release $dlg destroy $dlg" - raise $dlg update + raise $dlg focus $dlg.ent } @@ -472,7 +479,7 @@ class StackMonitor { if {$enabled} { set state {normal} - } { + } else { set state {disabled} } @@ -517,3 +524,7 @@ class StackMonitor { $values_txt configure -state disabled } } + +# >>> File inclusion guard +} +# <<< File inclusion guard |