summaryrefslogtreecommitdiff
path: root/lib/rightpanel/regwatches.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rightpanel/regwatches.tcl')
-rw-r--r--[-rwxr-xr-x]lib/rightpanel/regwatches.tcl273
1 files changed, 149 insertions, 124 deletions
diff --git a/lib/rightpanel/regwatches.tcl b/lib/rightpanel/regwatches.tcl
index ad5e433..6760cab 100755..100644
--- a/lib/rightpanel/regwatches.tcl
+++ b/lib/rightpanel/regwatches.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 _REGWATCHES_TCL ] } {
+set _REGWATCHES_TCL _
+# <<< File inclusion guard
+
# --------------------------------------------------------------------------
# DESCRIPTION
# Implements register watches (part of Right Panel)
@@ -34,7 +39,7 @@ class RegWatches {
# Counter of embedded entry widgets in register watches
common watch_entry_count 0
# Conter of instances
- common count 0
+ common regw_count 0
## Highlighting tags for register watches
# {
# {tag_name foreground_color ?bold_or_italic?}
@@ -47,7 +52,7 @@ class RegWatches {
{tag_addr #0000DD 1}
{tag_name #8888DD {}}
}
- common regfont [font create -family $::DEFAULT_FIXED_FONT -size -14]
+ common regfont [font create -family $::DEFAULT_FIXED_FONT -size [expr {int(-14 * $::font_size_factor)}]]
# Popup menu for register watches
common WATCHMENU {
{command {Move top} {$watches:top} 0 "rightPanel_watch_move_top"
@@ -72,12 +77,12 @@ class RegWatches {
}
# Configuration menu
common CONFMENU {
- {cascade {Sort by} 0 "" .sort false 1 {
- {command {Name} {} 0 "rightPanel_watch_sort_by N" {}
+ {cascade "Sort by" 0 "" .sort false 1 {
+ {command "Name" {} 0 "rightPanel_watch_sort_by N" {}
""}
- {command {Address} {} 0 "rightPanel_watch_sort_by A" {}
+ {command "Address" {} 0 "rightPanel_watch_sort_by A" {}
""}
- {command {Type} {} 0 "rightPanel_watch_sort_by T" {}
+ {command "Type" {} 0 "rightPanel_watch_sort_by T" {}
""}
{separator}
{radiobutton "Incremental" {} ::RegWatches::sorting_order 1
@@ -85,18 +90,20 @@ class RegWatches {
{radiobutton "Decremental" {} ::RegWatches::sorting_order 0
{} 0 ""}
}}
- {command {Remove all} {} 0 "rightPanel_watch_clear" {editdelete}
+ {command "Remove all" {} 0 "rightPanel_watch_clear" {editdelete}
""}
{separator}
- {checkbutton {Autoload from code listing} {} {::RegWatches::menu_autoload} 1 0 0
+ {checkbutton "Autoload from code listing" {} {::RegWatches::menu_autoload} 1 0 0
{rightPanel_watch_toggle_autoload_flag}}
+ {checkbutton "Clear on auto-load" {} {::RegWatches::menu_autoclear} 1 0 0
+ {rightPanel_watch_toggle_autoclear_flag}}
}
## PRIVATE
private variable enabled 0 ;# Bool: enable procedures which are needless while loading project
private variable obj_idx ;# Number of this object
private variable parent ;# Widget: parent widget
- private variable gui_initialized 0 ;# Bool: GUI initialized
+ private variable regw_gui_initialized 0 ;# Bool: GUI initialized
private variable conf_button ;# Widget: Configuration button
private variable conf_menu {} ;# Configuration menu
@@ -111,6 +118,7 @@ class RegWatches {
# Bool: Autoload from LST file
private variable autoload_flag [lindex $::CONFIG(REGWATCHES_CONFIG) 0]
+ private variable autoclear_flag [lindex $::CONFIG(REGWATCHES_CONFIG) 2]
private variable watches_modified 0 ;# Bool: Register watches definition modified
private variable search_val_in_progress 0 ;# Bool: Search entry validation in porgress
private variable watch_file_name {} ;# Name of file currently loaded in register watches
@@ -128,13 +136,13 @@ class RegWatches {
## Object constructor
constructor {} {
- incr count
- set obj_idx $count
+ incr regw_count
+ set obj_idx $regw_count
}
## Object destructor
destructor {
- if {$gui_initialized} {
+ if {$regw_gui_initialized} {
# Remove status bar tips for popup menus
menu_Sbar_remove $watch_menu
@@ -151,14 +159,14 @@ class RegWatches {
public method PrepareRegWatches {_parent filename} {
set parent $_parent
set watch_file_name $filename
- set gui_initialized 0
+ set regw_gui_initialized 0
}
## Create GUI of register watches
# @return void
public method CreateRegWatchesGUI {} {
- if {$gui_initialized} {return}
- set gui_initialized 1
+ if {$regw_gui_initialized} {return}
+ set regw_gui_initialized 1
# Top frame
set icon_bar [frame $parent.frm_rightPanel_watch_iconBar]
@@ -196,9 +204,9 @@ class RegWatches {
-style Flat.TButton \
]
pack $button -side left -padx 3
- DynamicHelp::add $button -text [mc "Save under a different filename"]
+ DynamicHelp::add $button -text [mc "Save under a different file name"]
setStatusTip -widget $button \
- -text [mc "Save under a different filename"]
+ -text [mc "Save under a different file name"]
# Separator
pack [ttk::separator $icon_bar.sep_rightPanel_watch_ib_sep0 \
-orient vertical \
@@ -248,10 +256,10 @@ class RegWatches {
# Entry "Address"
set entry [ttk::entry $tool_bar.ent_rightPanel_watch_addr \
- -textvariable RightPanel::watch_addr$count \
+ -textvariable RightPanel::watch_addr${regw_count} \
-validatecommand "$this rightPanel_watch_addr_validate %P" \
-validate key \
- -width 4 \
+ -width 5 \
]
DynamicHelp::add $entry \
-text [mc "Register address:\n 1 or 2 digits\tinternal RAM (not SFR)\n 3 digits\t\texpanded RAM\n 4 digits\t\texternal RAM\n dot and 2 digits\tBit"]
@@ -263,7 +271,7 @@ class RegWatches {
# Entry "Name"
set entry [ttk::entry $tool_bar.ent_rightPanel_watch_name \
- -textvariable RightPanel::watch_name$count \
+ -textvariable RightPanel::watch_name${regw_count} \
-validatecommand "$this rightPanel_watch_name_validate %P" \
-validate key \
-width 20 \
@@ -378,7 +386,7 @@ class RegWatches {
3 {
if {[string index $addr 0] == {.}} {
set type {B}
- } {
+ } else {
set type {E}
}
}
@@ -394,7 +402,7 @@ class RegWatches {
if {$::RegWatches::sorting_order} {
set order {-increasing}
# Decremental sorting order
- } {
+ } else {
set order {-decreasing}
}
@@ -430,6 +438,9 @@ class RegWatches {
if {!$autoload_flag} {return}
if {![file exists $filename]} {return}
+ if {$autoclear_flag} {
+ rightPanel_watch_clear 1
+ }
rightPanel_watch_import_file $filename .
}
@@ -439,10 +450,20 @@ class RegWatches {
set autoload_flag $::RegWatches::menu_autoload
}
+ ## Autoclear flag toggled (this function should be invoked from configuration menu)
+ # @return void
+ public method rightPanel_watch_toggle_autoclear_flag {} {
+ set autoclear_flag $::RegWatches::menu_autoclear
+ }
+
## Get configuration list
# @return void
public method rightPanel_watch_get_config {} {
- return [list $::RegWatches::menu_autoload $::RegWatches::sorting_order]
+ return [list \
+ $autoload_flag \
+ $::RegWatches::sorting_order \
+ $autoclear_flag \
+ ]
}
## Create configuration menu
@@ -452,7 +473,7 @@ class RegWatches {
return
}
set conf_menu $parent.conf_menu
- menuFactory $CONFMENU $conf_menu 0 "$this " 0 {}
+ menuFactory $CONFMENU $conf_menu 0 "$this " 0 {} [namespace current]
watch_disEna_buttons
}
@@ -467,22 +488,23 @@ class RegWatches {
incr y [winfo height $conf_button]
set ::RegWatches::menu_autoload $autoload_flag
+ set ::RegWatches::menu_autoclear $autoclear_flag
tk_popup $conf_menu $x $y
}
## Refresh highlighting tags
# @return void
public method rightPanel_refresh_regwatches_highlighting {} {
- if {!$gui_initialized} {return}
+ if {!$regw_gui_initialized} {return}
$this right_panel_create_highlighting_tags $watch_text $watch_text_tags -1
}
## Recreate popup menu
# @return void
public method regwatches_makePopupMenu {} {
- if {!$gui_initialized} {return}
+ if {!$regw_gui_initialized} {return}
if {[winfo exists $watch_menu]} {destroy $watch_menu}
- menuFactory $WATCHMENU $watch_menu 0 "$this " 0 {}
+ menuFactory $WATCHMENU $watch_menu 0 "$this " 0 {} [namespace current]
}
@@ -497,7 +519,7 @@ class RegWatches {
if {![string first $prj_path $watch_file_name]} {
return [string range $watch_file_name [string length $prj_path] end]
# Return absolute directory location
- } {
+ } else {
return $watch_file_name
}
}
@@ -506,7 +528,7 @@ class RegWatches {
# @parm Widget entry - Target entry widget
# @return void
private method watch_entry_shortcuts_reset {entry} {
- if {!$gui_initialized} {return}
+ if {!$regw_gui_initialized} {return}
# Unset previous configuration
foreach key $watches_set_shortcuts {
@@ -554,13 +576,13 @@ class RegWatches {
return { .00}
}
if {$string == "\n"} {
- set string [subst "\$::RightPanel::watch_addr${obj_idx}"]
+ set string [subst -nocommands "\$::RightPanel::watch_addr${obj_idx}"]
regsub {^\s+} $string {} string
}
if {[string index $string 0] == {.}} {
set string [string replace $string 0 0]
set bit_addr 1
- } {
+ } else {
set bit_addr 0
}
@@ -570,7 +592,7 @@ class RegWatches {
if {$len != 4} {
set string " $string"
}
- } {
+ } else {
if {$len == 1} {
set string "0$string"
}
@@ -580,7 +602,7 @@ class RegWatches {
# Resturn result
if {$bit_addr} {
return [string replace $string 1 1 {.}]
- } {
+ } else {
return [string toupper $string]
}
}
@@ -591,7 +613,7 @@ class RegWatches {
private method get_watchName {string} {
# Conditionaly get value from entry widget
if {$string == "\n"} {
- set string [subst "\$::RightPanel::watch_name${obj_idx}"]
+ set string [subst -nocommands "\$::RightPanel::watch_name${obj_idx}"]
regsub {\t+$} $string {} string
}
@@ -770,7 +792,7 @@ class RegWatches {
if {[string index $addr 0] == {.}} {
set addr [string replace $addr 0 0]
set bit_addr 1
- } {
+ } else {
set bit_addr 0
}
set dec_addr [expr "0x$addr"]
@@ -820,7 +842,7 @@ class RegWatches {
# AFFECT ALL ENTRIES (not only valid ones) !!!
# @return void
public method rightPanel_watch_force_enable {} {
- if {!$gui_initialized} {CreateRegWatchesGUI}
+ if {!$regw_gui_initialized} {CreateRegWatchesGUI}
set watches_enabled 1
foreach addr $watch_addrs {
@@ -832,14 +854,14 @@ class RegWatches {
# Affect only entries with valid address (implemented on current MCU)
# @return void
public method rightPanel_watch_enable {} {
- if {!$gui_initialized} {CreateRegWatchesGUI}
+ if {!$regw_gui_initialized} {CreateRegWatchesGUI}
set watches_enabled 1
foreach addr $watch_addrs {
if {[string index $addr 0] == {.}} {
set addr [string replace $addr 0 0]
set bit_addr 1
- } {
+ } else {
set bit_addr 0
}
set dec_addr [expr "0x$addr"]
@@ -848,7 +870,7 @@ class RegWatches {
# Bit
if {$bit_addr} {
if {$dec_addr > 0x7F} {
- if {![$this simulator_is_sfr_avaliable [$this getRegOfBit $dec_addr]]} {
+ if {![$this simulator_is_sfr_available [$this getRegOfBit $dec_addr]]} {
continue
}
}
@@ -880,7 +902,7 @@ class RegWatches {
## Disable all entry widgets in register watches
# @return void
public method rightPanel_watch_disable {} {
- if {!$gui_initialized} {return}
+ if {!$regw_gui_initialized} {return}
set watches_enabled 0
foreach addr $watch_addrs {
@@ -900,7 +922,7 @@ class RegWatches {
# @parm Int row - target line
# @return void
public method rightPanel_watch_switch_line {row} {
- if {!$gui_initialized} {return}
+ if {!$regw_gui_initialized} {return}
set watch_AN_valid_ena 0
# Determinate number of the last row
@@ -928,7 +950,7 @@ class RegWatches {
set ::RightPanel::watch_addr${obj_idx} {}
set watch_AN_valid_ena 1
return 0
- } {
+ } else {
set watch_curLine $row
$watch_remove_button configure -state normal
$watch_new_button configure -state normal
@@ -982,7 +1004,7 @@ class RegWatches {
set addr [get_watchAddr "\n"]
set name [get_watchName "\n"]
set no_sbar 0
- } {
+ } else {
set addr [get_watchAddr $addr]
set name [get_watchName $name]
set no_sbar 1
@@ -1061,7 +1083,7 @@ class RegWatches {
private method watch_create_entry {addr row var} {
if {[string index $addr 0] == {.}} {
set width 1
- } {
+ } else {
set width 2
}
@@ -1096,7 +1118,7 @@ class RegWatches {
## Clear highlight for all registers
# @return void
public method rightPanel_watch_clear_highlight {} {
- if {!$gui_initialized} {return}
+ if {!$regw_gui_initialized} {return}
foreach addr $watch_addrs {
$watch_text.[lindex $watch_data($addr) 1] configure -fg ${Simulator::normal_color}
@@ -1106,7 +1128,7 @@ class RegWatches {
## Clear highlight for the given register
# @return void
public method rightPanel_watch_unhighlight {addr} {
- if {!$gui_initialized} {return}
+ if {!$regw_gui_initialized} {return}
if {[lsearch $watch_addrs $addr] == -1} {
return
@@ -1187,7 +1209,7 @@ class RegWatches {
set addr_tag {tag_Baddr}
} elseif {$len == 3} {
set addr_tag {tag_Eaddr}
- } {
+ } else {
set addr_tag {tag_addr}
}
# Restore text tags
@@ -1277,18 +1299,20 @@ class RegWatches {
public method rightPanel_watch_remove {} {
# Determinate register address
set addr [lindex $watch_addrs [expr {$watch_curLine - 1}]]
- # Destroy value entry
- set var [lindex $watch_data($addr) 1]
- destroy $watch_text.$var
- # Unregister watch
- unset watch_data($addr)
- set idx [lsearch $watch_addrs $addr]
- set watch_addrs [lreplace $watch_addrs $idx $idx]
+ if {$addr != {}} {
+ # Destroy value entry
+ set var [lindex $watch_data($addr) 1]
+ destroy $watch_text.$var
+ # Unregister watch
+ unset watch_data($addr)
+ set idx [lsearch $watch_addrs $addr]
+ set watch_addrs [lreplace $watch_addrs $idx $idx]
- # Remove watch from the text widget
- $watch_text configure -state normal
- $watch_text delete $watch_curLine.0 "$watch_curLine.0 + 1 line"
- $watch_text configure -state disabled
+ # Remove watch from the text widget
+ $watch_text configure -state normal
+ $watch_text delete $watch_curLine.0 "$watch_curLine.0 + 1 line"
+ $watch_text configure -state disabled
+ }
# Change current line
if {$watch_curLine > [llength $watch_addrs]} {
@@ -1296,6 +1320,8 @@ class RegWatches {
}
if {$watch_curLine} {
rightPanel_watch_switch_line $watch_curLine
+ } else {
+ rightPanel_watch_switch_line 1
}
# Reevaluate button states
@@ -1308,33 +1334,28 @@ class RegWatches {
## Save watches definition to a file
# @parm String filename - Target filename or an empty string
- # @parm Bool force = 0 - Do not ask for overwrite
+ # @parm Bool force=0 - Do not ask for overwrite
# @return void
- public method rightPanel_watch_save args {
- if {!$gui_initialized} {CreateRegWatchesGUI}
+ public method rightPanel_watch_save {filename {force 0}} {
+ if {!$regw_gui_initialized} {CreateRegWatchesGUI}
- set filename [lindex $args 0]
- set force [lindex $args 1]
if {$filename != {}} {
set watch_file_name $filename
}
- if {$force != {1}} {
- set force 0
- }
# If no filename specified -> invoke dislog "Save as"
if {$watch_file_name == {}} {
rightPanel_watch_saveas
# Save file
- } {
+ } else {
# Set new filename
if {!$::MICROSOFT_WINDOWS} { ;# POSIX way
if {![regexp "^(~|/)" $watch_file_name]} {
set filename "[$this cget -ProjectDir]/$watch_file_name"
}
- } { ;# Microsoft windows way
- if {![regexp "^\w:" $watch_file_name]} {
+ } else { ;# Microsoft windows way
+ if {![regexp {^\w:} $watch_file_name]} {
set filename [file join [$this cget -ProjectDir] $watch_file_name]
}
}
@@ -1354,7 +1375,7 @@ class RegWatches {
-title [mc "Overwrite file"] \
-message [mc "A file name '%s' already exists. Are you sure you want to overwrite it ?" [file tail $watch_file_name]]
] != {yes}
- } {
+ } then {
return
}
# Create a backup file
@@ -1363,11 +1384,11 @@ class RegWatches {
}
}
if {[catch {
- set file [open $watch_file_name w 420]
- }]} {
+ set file [open $watch_file_name w 0640]
+ }]} then {
if {[winfo exists .fsd]} {
set parent .fsd
- } {
+ } else {
set parent .
}
tk_messageBox -type ok \
@@ -1379,7 +1400,6 @@ class RegWatches {
# Write file header
puts $file "# Watches definition file -- ${::APPNAME}"
- puts $file "# Date: [clock format [clock seconds] -format {%D}]"
# Write watches definition
puts -nonewline $file [regsub -all -line {\s+$} [$watch_text get 1.0 end] {}]
@@ -1404,10 +1424,10 @@ class RegWatches {
KIFSD::FSD ::fsd \
-title [mc "Save watches - MCU 8051 IDE"] \
-directory [$this cget -ProjectDir] \
- -defaultmask 0 -multiple 0 -filetypes {
- {{MCU 8051 IDE watch definition} {*.wtc} }
- {{All files} {*} }
- }
+ -defaultmask 0 -multiple 0 -filetypes [list \
+ [list [mc "MCU 8051 IDE watches definition"] {*.wtc}] \
+ [list [mc "All files"] {*}] \
+ ]
# Save file after press of OK button
::fsd setokcmd {
set ::filename [::fsd get]
@@ -1421,19 +1441,19 @@ class RegWatches {
## Open and process watches definition file
# @parm String filename - name of source file
- # @parm Widget parent - GUI parent (for error dialogs)
+ # @parm Widget parent - GUI parent (for error dialogues)
# @parm Bool clear - Clear watches before loading
# @return Bool - result
public method rightPanel_watch_openfile {filename parent clear} {
- if {!$gui_initialized} {CreateRegWatchesGUI}
+ if {!$regw_gui_initialized} {CreateRegWatchesGUI}
# Normalize filename
if {!$::MICROSOFT_WINDOWS} { ;# POSIX way
if {![regexp "^(~|/)" $filename]} {
set filename "[$this cget -projectPath]/$filename"
}
- } { ;# Microsoft windows way
- if {![regexp "^\w:" $filename]} {
+ } else { ;# Microsoft windows way
+ if {![regexp {^\w:} $filename]} {
set filename [file join [$this cget -projectPath] $filename]
}
}
@@ -1446,7 +1466,10 @@ class RegWatches {
if {[catch {
set file [open $filename r]
}]} then {
- tk_messageBox -parent $parent -icon warning -type ok \
+ tk_messageBox \
+ -parent $parent \
+ -icon warning \
+ -type ok \
-title [mc "File access error"] \
-message [mc "Unable to read file '%s'" $filename]
set watch_file_name {}
@@ -1471,11 +1494,11 @@ class RegWatches {
![regexp {^\s*\.?[A-Fa-f0-9]+$} $addr] ||
[string length $addr] > 4 ||
[string length $name] > 23
- } {
+ } then {
tk_messageBox \
-title [mc "Corrupted file"] \
-icon error -type ok -parent $parent \
- -message [mc "file: %s is eighter corrupted or it is not a file in expected format." $filename]
+ -message [mc "file: %s is either corrupted or it is not a file in expected format." $filename]
return 0
}
}
@@ -1524,16 +1547,16 @@ class RegWatches {
KIFSD::FSD ::fsd \
-title [mc "Load watches from file - MCU 8051 IDE"] \
-directory [$this cget -ProjectDir] -autoclose 0 \
- -defaultmask 0 -multiple 0 -filetypes {
- {{MCU 8051 IDE watches definition} {*.wtc} }
- {{All files} {*} }
- }
+ -defaultmask 0 -multiple 0 -filetypes [list \
+ [list [mc "MCU 8051 IDE watches definition"] {*.wtc}] \
+ [list [mc "All files"] {*}] \
+ ]
# Open file after press of OK button
fsd setokcmd {
# Get chosen file name
set filename [::fsd get]
- if {[${X::actualProject} rightPanel_watch_openfile $filename [::fsd get_window_name] 1]} {
+ if {[${::X::actualProject} rightPanel_watch_openfile $filename [::fsd get_window_name] 1]} {
::fsd deactivate
delete object fsd
}
@@ -1550,17 +1573,17 @@ class RegWatches {
KIFSD::FSD ::fsd \
-title [mc "Import file - MCU 8051 IDE"] \
-directory [$this cget -ProjectDir] -autoclose 0 \
- -defaultmask 0 -multiple 0 -filetypes {
- {{Code listing} {*.lst} }
- {{MCU 8051 IDE watches definition} {*.wtc} }
- {{All files} {*} }
- }
+ -defaultmask 0 -multiple 0 -filetypes [list \
+ [list [mc "Code listing"] {*.lst}] \
+ [list [mc "MCU 8051 IDE watches definition"] {*.wtc}] \
+ [list [mc "All files"] {*}] \
+ ]
# Open file after press of OK button
fsd setokcmd {
# Get chosen file name
set filename [::fsd get]
- if {[${X::actualProject} rightPanel_watch_import_file $filename [::fsd get_window_name]]} {
+ if {[${::X::actualProject} rightPanel_watch_import_file $filename [::fsd get_window_name]]} {
::fsd deactivate
delete object fsd
}
@@ -1572,15 +1595,15 @@ class RegWatches {
## Import file
# @parm String filename - Name of source file (*.lst or *.wtc)
- # @parm Widget parent - GUI parent (for error dialogs)
+ # @parm Widget parent - GUI parent (for error dialogues)
# @return Bool - result
public method rightPanel_watch_import_file {filename parent} {
- if {!$gui_initialized} {CreateRegWatchesGUI}
+ if {!$regw_gui_initialized} {CreateRegWatchesGUI}
# Determinate file type
set filename [file normalize [file join [$this cget -ProjectDir] $filename]]
set file_type 0
- switch -- [file extension $filename] {
+ switch -nocase -- [file extension $filename] {
{.wtc} { ;# Watches definition file
set file_type 1
}
@@ -1624,7 +1647,7 @@ class RegWatches {
# Try to open file
if {[catch {
set file [open $filename r]
- }]} {
+ }]} then {
tk_messageBox \
-parent . \
-type ok \
@@ -1757,16 +1780,10 @@ class RegWatches {
}
## Remove all register watches
- # Bool force = 0 - Don't ask user for comfirmation
+ # Bool force=0 - Don't ask for user comfirmation
# @return void
- public method rightPanel_watch_clear args {
- if {!$gui_initialized} {CreateRegWatchesGUI}
-
- # Parse arguments
- set force [lindex $args 0]
- if {$force == {}} {
- set force 0
- }
+ public method rightPanel_watch_clear {{force 0}} {
+ if {!$regw_gui_initialized} {CreateRegWatchesGUI}
# Ask user for comfirmation
if {!$force} {
@@ -1819,7 +1836,7 @@ class RegWatches {
# Enable/Disable button "Clear search entry"
if {$content == {}} {
$watch_search_clear configure -state disabled
- } {
+ } else {
$watch_search_clear configure -state normal
}
@@ -1858,7 +1875,7 @@ class RegWatches {
## Syncronize all register watches
# @return void
public method rightPanel_watch_sync_all {} {
- if {!$gui_initialized} {CreateRegWatchesGUI}
+ if {!$regw_gui_initialized} {CreateRegWatchesGUI}
# Iterate over addresses
foreach addr $watch_addrs {
@@ -1881,7 +1898,7 @@ class RegWatches {
return {--}
}
set bit_addr 1
- } {
+ } else {
set bit_addr 0
}
set len [string length $addr]
@@ -1891,10 +1908,10 @@ class RegWatches {
# Bit
if {$bit_addr} {
if {$addr_dec > 0x7F} {
- if {[$this simulator_is_sfr_avaliable [$this getRegOfBit $addr_dec]]} {
+ if {[$this simulator_is_sfr_available [$this getRegOfBit $addr_dec]]} {
set val [$this getBit $addr_dec]
}
- } {
+ } else {
set val [$this getBit $addr_dec]
}
@@ -1929,6 +1946,7 @@ class RegWatches {
# @parm Int dec_addr - SFR register address
# @return void
public method rightPanel_watch_sync_sfr {dec_addr} {
+
if {$validator_engaged} {
return
}
@@ -1947,12 +1965,12 @@ class RegWatches {
# @return Bool - result
public method rightPanel_watch_sync {addr} {
if {$validator_engaged} {return 1}
- if {!$gui_initialized} {CreateRegWatchesGUI}
+ if {!$regw_gui_initialized} {CreateRegWatchesGUI}
# Detect bit address
if {[string index $addr 0] == {.}} {
set bit_addr 1
- } {
+ } else {
set bit_addr 0
}
@@ -1961,6 +1979,7 @@ class RegWatches {
# Synchronize bits in the given register
if {!$validator_engaged && [string length $addr] == 2} {
+
set dec_addr [expr "0x$addr"]
if {$dec_addr >= 0x20 && $dec_addr <= 0x2F} {
@@ -1971,6 +1990,7 @@ class RegWatches {
if {[string length $hex_addr] == 1} {
set hex_addr "0$hex_addr"
}
+
rightPanel_watch_sync .$hex_addr
incr dec_addr
}
@@ -2014,11 +2034,11 @@ class RegWatches {
## Enable/Disable buttons on watches icon bar
# @return void
private method watch_disEna_buttons {} {
- if {!$gui_initialized} {return}
+ if {!$regw_gui_initialized} {return}
if {[$watch_text index end] == {2.0}} {
set state {disabled}
- } {
+ } else {
set state {normal}
}
@@ -2047,10 +2067,10 @@ class RegWatches {
## Enable/Disable menu items
# If address entry is not empty -> disable all
- set addr [subst "\$::RightPanel::watch_addr${obj_idx}"]
+ set addr [subst -nocommands "\$::RightPanel::watch_addr${obj_idx}"]
if {$addr != {}} {
set end [$watch_text index end]
- } {
+ } else {
set end {2.0}
}
# Empty list
@@ -2102,7 +2122,7 @@ class RegWatches {
## Create bindings for defined key shortcuts -- register watches
# @return void
public method rightPanel_watch_shortcuts_reevaluate {} {
- if {!$gui_initialized} {return}
+ if {!$regw_gui_initialized} {return}
foreach addr $watch_addrs {
watch_entry_shortcuts_reset watch_text.[lindex $watch_data($addr) 1]
}
@@ -2116,5 +2136,10 @@ class RegWatches {
}
}
-set ::RegWatches::menu_autoload [lindex $::CONFIG(REGWATCHES_CONFIG) 0]
-set ::RegWatches::sorting_order [lindex $::CONFIG(REGWATCHES_CONFIG) 1]
+set ::RegWatches::menu_autoload [lindex $::CONFIG(REGWATCHES_CONFIG) 0]
+set ::RegWatches::sorting_order [lindex $::CONFIG(REGWATCHES_CONFIG) 1]
+set ::RegWatches::menu_autoclear [lindex $::CONFIG(REGWATCHES_CONFIG) 2]
+
+# >>> File inclusion guard
+}
+# <<< File inclusion guard