summaryrefslogtreecommitdiff
path: root/lib/simulator/sfrmap.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/simulator/sfrmap.tcl')
-rw-r--r--[-rwxr-xr-x]lib/simulator/sfrmap.tcl83
1 files changed, 34 insertions, 49 deletions
diff --git a/lib/simulator/sfrmap.tcl b/lib/simulator/sfrmap.tcl
index d6d16d2..65e5806 100755..100644
--- a/lib/simulator/sfrmap.tcl
+++ b/lib/simulator/sfrmap.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,14 +21,19 @@
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
############################################################################
+# >>> File inclusion guard
+if { ! [ info exists _SFRMAP_TCL ] } {
+set _SFRMAP_TCL _
+# <<< File inclusion guard
+
# --------------------------------------------------------------------------
# DESCRIPTION
-# Implements window showing the map of avaliable special function register
+# Implements window showing the map of available special function register
# --------------------------------------------------------------------------
class SFRMap {
## COMMON
- common count 0 ;# Int: Counter of object instances
+ common sfrmap_count 0 ;# Int: Counter of object instances
## PRIVATE
private variable dialog_opened 0 ;# Bool: Dialog window opened
@@ -46,7 +51,7 @@ class SFRMap {
private variable selected_entry -1 ;# Int: Address of selected entry box in the map
constructor {} {
- incr count
+ incr sfrmap_count
}
destructor {
@@ -63,14 +68,14 @@ class SFRMap {
# Create dialog window
set enabled [$this is_frozen]
- set win [toplevel .sfr_map$count -bg {#FFFFFF} -class {SFR map} -bg {#EEEEEE}]
+ set win [toplevel .sfr_map${sfrmap_count} -bg {#FFFFFF} -class {SFR map} -bg ${::COMMON_BG_COLOR}]
# Create other widgets
create_win_gui
# Configure the window
wm iconphoto $win ::ICONS::16::kcmmemory_S
- wm title $win "Map of SFR area - [string trim $this {:}] - MCU 8051 IDE"
+ wm title $win "[mc {Map of SFR area}] - [$this cget -P_option_mcu_type] - [$this cget -projectName] - MCU 8051 IDE"
wm resizable $win 0 0
wm protocol $win WM_DELETE_WINDOW "$this sfrmap_close_dialog"
bindtags $win [list $win Toplevel all .]
@@ -146,34 +151,29 @@ class SFRMap {
set name [lindex $reg 1]
set row 0
- lappend defined_sfr $addr
-
- switch -- $name {
- {SBUFR} {
- set name_d {SBUF R}
- }
- {SBUFT} {
- set name_d {SBUF T}
- }
- default {
- set name_d $name
- }
+ if {$addr > 255} {
+ continue
}
-
- set n_addr [expr {$addr & 0x0FF}]
- if {$addr > 0xFF} {
- set row 1
+ if {$name == {SBUFR} || $name == {SBUFT}} {
+ set name {SBUF}
}
if {!($addr % 8)} {
set fg {#00DDDD}
- } {
+ } else {
set fg {#0000DD}
}
- $main_frame.cell_$n_addr configure -bg {#FFFFFF}
- grid [label $main_frame.lbl_${addr} \
- -text $name_d -bg {#FFFFFF} -fg $fg \
- ] -in $main_frame.cell_$n_addr -sticky nsw -row $row -column 0
+ $main_frame.cell_$addr configure -bg {#FFFFFF}
+ pack [label $main_frame.lbl_${addr} \
+ -text $name -bg {#FFFFFF} -fg $fg \
+ ] -in $main_frame.cell_$addr -side left
+
+ grid columnconfigure $main_frame.cell_$addr 0 -weight 1
+ if {$name == {SBUF}} {
+ continue
+ }
+ lappend defined_sfr $addr
+
set entry [ttk::entry $main_frame.ent_${addr} \
-validatecommand "$this sfrmap_validate $addr h %P m" \
-style Simulator_WhiteBg.TEntry \
@@ -182,30 +182,11 @@ class SFRMap {
-width 3 \
-font ${::Simulator_GUI::entry_font} \
]
- grid $entry -in $main_frame.cell_$n_addr -padx 1 -pady 1 -row $row -column 1 -sticky nse
+ pack $entry -in $main_frame.cell_$addr -side right
$entry insert end [$this getSfr $addr]
if {!$enabled} {
$entry configure -state disabled
}
- if {$row} {
- foreach widget [list \
- $main_frame.lbl_${addr} $main_frame.lbl_${n_addr} \
- $main_frame.ent_${addr} $main_frame.ent_${n_addr} \
- ] {
- catch {$widget configure -highlightthickness 0}
- catch {$widget configure -pady 0}
- catch {$widget configure -bd 0}
-
- $widget configure -font [font create -family $::DEFAULT_FIXED_FONT -size -3]
- grid configure $widget -pady 0 -ipady 0
- }
- foreach widget [list $main_frame.lbl_${addr} $main_frame.lbl_${n_addr}] {
- $widget configure -pady 0
- }
- grid rowconfigure $main_frame.cell_$n_addr 0 -pad 0
- grid rowconfigure $main_frame.cell_$n_addr 1 -pad 0
- }
- grid columnconfigure $main_frame.cell_$n_addr 0 -weight 1
bindtags $entry [list $entry TEntry $win all .]
bind $entry <Motion> {help_window_show %X %Y+30}
@@ -500,13 +481,13 @@ class SFRMap {
set enabled $bool
if {$bool} {
set bool {normal}
- } {
+ } else {
set bool {disabled}
}
foreach entry [list $det_hex $det_oct $det_bin $det_dec] {
$entry configure -state $bool
}
- foreach addr [$this simulator_get_avaliable_sfr] {
+ foreach addr $defined_sfr {
$main_frame.ent_${addr} configure -state $bool
}
}
@@ -521,3 +502,7 @@ class SFRMap {
}
}
}
+
+# >>> File inclusion guard
+}
+# <<< File inclusion guard