summaryrefslogtreecommitdiff
path: root/lib/simulator/interruptmonitor.tcl
diff options
context:
space:
mode:
authorAndrej Shadura <andrewsh@debian.org>2018-05-08 15:59:31 +0200
committerAndrej Shadura <andrewsh@debian.org>2018-05-08 15:59:31 +0200
commit47aa8b00b2b11df13a100489e0f904a4947177ef (patch)
treeb35c9acc778ea2f761f3c549f7bee2f4491b3144 /lib/simulator/interruptmonitor.tcl
parent5b8466f7fae0e071c0f4eda13051c93313910028 (diff)
Import Upstream version 1.4.7
Diffstat (limited to 'lib/simulator/interruptmonitor.tcl')
-rw-r--r--[-rwxr-xr-x]lib/simulator/interruptmonitor.tcl154
1 files changed, 84 insertions, 70 deletions
diff --git a/lib/simulator/interruptmonitor.tcl b/lib/simulator/interruptmonitor.tcl
index 5156382..510b070 100755..100644
--- a/lib/simulator/interruptmonitor.tcl
+++ b/lib/simulator/interruptmonitor.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 _INTERRUPTMONITOR_TCL ] } {
+set _INTERRUPTMONITOR_TCL _
+# <<< File inclusion guard
+
# --------------------------------------------------------------------------
# DESCRIPTION
# Implements interrupt monitor
@@ -29,33 +34,37 @@
class InterruptMonitor {
## COMMON
common geometry ${::CONFIG(INTR_MON_GEOMETRY)} ;# Last window geometry
- common count 0 ;# Counter of intances
+ common intr_mon_count 0 ;# Counter of intances
common bg_color {#0088FF} ;# Color for highlighted background
# Small header font
- common header_font [font create \
- -size -17 -weight bold \
- -family {helvetica} \
+ common header_font [font create \
+ -size [expr {int(-17 * $::font_size_factor)}] \
+ -weight bold \
+ -family {helvetica} \
]
# Big header font
- common header_font_big [font create \
- -size -21 -weight bold \
- -family {helvetica} \
+ common header_font_big [font create \
+ -size [expr {int(-21 * $::font_size_factor)}] \
+ -weight bold \
+ -family {helvetica} \
]
# Common label font
- common lbl_font [font create \
- -size -12 \
- -family {helvetica} \
+ common lbl_font [font create \
+ -size [expr {int(-12 * $::font_size_factor)}] \
+ -family {helvetica} \
]
# Font for value labels
- common val_font [font create \
- -size -12 -weight bold \
- -family {helvetica} \
+ common val_font [font create \
+ -size [expr {int(-12 * $::font_size_factor)}] \
+ -weight bold \
+ -family {helvetica} \
]
# Font for value labels - underline
- common val_font_under [font create \
- -size -12 -weight bold \
- -family {helvetica} \
- -underline 1 \
+ common val_font_under [font create \
+ -size [expr {int(-12 * $::font_size_factor)}] \
+ -weight bold \
+ -family {helvetica} \
+ -underline 1 \
]
@@ -74,7 +83,7 @@ class InterruptMonitor {
private variable in_progress_flg {} ;# List: Flags of interrupts which are in progress
private variable intr_priorities {} ;# List: Interrupt flags in order of their priorities (decremental)
private variable pending_flg {} ;# List: Flags of pending interrupts
- private variable avaliable_interrs {} ;# List: Avaliable interrupt flags
+ private variable available_interrs {} ;# List: available interrupt flags
private variable maximum_priority 0 ;# Int: Maximum valid priority
@@ -106,7 +115,7 @@ class InterruptMonitor {
set in_progress_flg {}
set pending_flg {}
set intr_priorities {}
- set avaliable_interrs {}
+ set available_interrs {}
if {[winfo exists $win]} {
destroy $win
@@ -120,22 +129,22 @@ class InterruptMonitor {
set dialog_opened 1
# Create dialog window, main frame and status bar
- set win [toplevel .interrupt_monitor$count -class {Interrupt monitor} -bg {#EEEEEE}]
- incr count
+ set win [toplevel .interrupt_monitor${intr_mon_count} -class {Interrupt monitor} -bg ${::COMMON_BG_COLOR}]
+ incr intr_mon_count
set main_frame [frame $win.main_frame]
set status_bar [label $win.status_bar]
# Create scrollable frames
set in_progress_frame_f [ScrollableFrame $main_frame.in_p \
- -width 300 -areawidth 300 \
+ -width 280 -areawidth 280 \
-yscrollcommand "$main_frame.in_p_scrl set" \
]
set pending_frame_f [ScrollableFrame $main_frame.pending \
- -width 230 -areawidth 230 \
+ -width 250 -areawidth 250 \
-yscrollcommand "$main_frame.pend_scrl set" \
]
set priorities_frame_f [ScrollableFrame $main_frame.prior \
- -width 230 -areawidth 230 \
+ -width 250 -areawidth 250 \
-yscrollcommand "$main_frame.prior_scrl set" \
]
@@ -144,11 +153,11 @@ class InterruptMonitor {
set top_frame_1 [frame $main_frame.top_frame_1]
set top_frame_2 [frame $main_frame.top_frame_2]
foreach num {0 1 2} text {
- {Interrupts in progress}
- {Pending interrupts}
- {Interrupt priorities}
+ "Interrupts in progress"
+ "Pending interrupts"
+ "Interrupt priorities"
} {
- set frame [subst "\$top_frame_${num}"]
+ set frame [subst -nocommands "\$top_frame_${num}"]
pack [ttk::button $frame.expand \
-image ::ICONS::16::add \
-style Flat.TButton \
@@ -163,7 +172,7 @@ class InterruptMonitor {
set_status_tip $frame.collapse [mc "Collapse all"]
pack [label $frame.in_p_lbl \
-font $header_font \
- -text $text \
+ -text [mc $text] \
] -side left -fill x -expand 1
}
@@ -203,7 +212,7 @@ class InterruptMonitor {
# Fill GUI
set maximum_priority [$this simulator_get_max_intr_priority]
- interrupt_monitor_set_avaliable [$this simulator_get_intr_flags]
+ interrupt_monitor_set_available [$this simulator_get_intr_flags]
interrupt_monitor_reevaluate
# Pack main frame and create bottom frame
@@ -217,17 +226,18 @@ class InterruptMonitor {
-command "$this interrupt_monitor_close" \
-image ::ICONS::16::button_cancel \
] -side right -pady 5 -padx 10
- set_status_tip $win.close_but {Close this dialog window}
+ set_status_tip $win.close_but [mc "Close this dialog window"]
# Set window attributes
wm iconphoto $win ::ICONS::16::kcmdf
- wm title $win "[mc {Interrupt monitor}] - [string trim $this {:}] - MCU 8051 IDE"
- wm minsize $win 840 270
+ wm title $win "[mc {Interrupt monitor}] - [$this cget -projectName] - MCU 8051 IDE"
+ wm minsize $win 850 270
if {$geometry != {}} {
+ regsub {\+\d+\+} $geometry {+850+} geometry
wm geometry $win $geometry
}
wm resizable $win 0 1
- wm protocol $win WM_DELETE_WINDOW "$this interrupt_monitor_close"
+ wm protocol $win WM_DELETE_WINDOW [list $this interrupt_monitor_close]
bindtags $win [list $win Toplevel all .]
}
@@ -256,7 +266,7 @@ class InterruptMonitor {
# Enable/Disabled buttons "Invoke this interrupt"
set state [expr {([$this is_frozen]) ? "normal" : "disabled"}]
- foreach flag $avaliable_interrs {
+ foreach flag $available_interrs {
$priorities_frame.[string tolower $flag].secondary.exec_but configure -state $state
}
@@ -291,8 +301,8 @@ class InterruptMonitor {
set in_progress_wdg {}
set in_progress_flg {}
set pending_flg {}
- set intr_priorities $avaliable_interrs
- foreach flag $avaliable_interrs {
+ set intr_priorities $available_interrs
+ foreach flag $available_interrs {
set flag [string tolower $flag]
$priorities_frame.$flag.secondary.exec_but configure -state normal
}
@@ -342,18 +352,18 @@ class InterruptMonitor {
public method interrupt_monitor_collapse_expand {widget} {
if {[winfo ismapped $widget]} {
pack forget $widget
- } {
+ } else {
pack $widget -fill both -padx 2 -pady 2
}
update
}
- ## Set avaliable interrupt flags
+ ## Set available interrupt flags
# @parm List flags - Interrupt flags (e.g. {TF2 CF RI IE0})
# @return void
- private method interrupt_monitor_set_avaliable {flags} {
- # Set avaliable interrupts
- set avaliable_interrs $flags
+ private method interrupt_monitor_set_available {flags} {
+ # Set available interrupts
+ set available_interrs $flags
# Create sub windows in frame "Priorities"
foreach flag_bit $flags {
@@ -374,7 +384,7 @@ class InterruptMonitor {
pack [label $secondary_frame.name \
-text [lindex $intr 3] -pady 0 \
-bg $bg_color -fg white \
- -cursor hand1 -anchor w \
+ -cursor hand2 -anchor w \
] -side left -anchor w -fill x -expand 1
bind $secondary_frame.name <Button-1> \
"$this interrupt_monitor_collapse_expand $primary_frame.tertiary"
@@ -405,7 +415,7 @@ class InterruptMonitor {
set row 2
set col 0
set pri_bits [lindex $intr 2]
- if {[$this get_feature_avaliable iph]} {
+ if {[$this get_feature_available iph]} {
set pri_bits [linsert $pri_bits 0 "[lindex $intr 2]H"]
}
foreach lbl {
@@ -441,7 +451,7 @@ class InterruptMonitor {
e_bit -
p_bit -
f_bit {
- set cursor {hand1}
+ set cursor {hand2}
set is_bit 1
}
}
@@ -514,11 +524,11 @@ class InterruptMonitor {
}
# Adjust value of priority level in each subwindow
- foreach flag_bit $avaliable_interrs {
+ foreach flag_bit $available_interrs {
set pri__clr [get_priority_and_color $flag_bit]
set pri_bits [lindex [get_interrupt_details $flag_bit] 2]
set flag_bit [string tolower $flag_bit]
- if {[$this get_feature_avaliable iph]} {
+ if {[$this get_feature_available iph]} {
lappend pri_bits "${pri_bits}H"
}
@@ -529,14 +539,14 @@ class InterruptMonitor {
if {[lindex $pri__clr 0] == $maximum_priority} {
$priorities_frame.$flag_bit.secondary.up_but \
configure -state disabled
- } {
+ } else {
$priorities_frame.$flag_bit.secondary.up_but \
configure -state normal
}
if {[lindex $pri__clr 0]} {
$priorities_frame.$flag_bit.secondary.down_but \
configure -state normal
- } {
+ } else {
$priorities_frame.$flag_bit.secondary.down_but \
configure -state disabled
}
@@ -556,7 +566,7 @@ class InterruptMonitor {
# Determinate new color
if {[intr_mon_getBit $pri_bit]} {
set color $::Simulator_GUI::on_color
- } {
+ } else {
set color $::Simulator_GUI::off_color
}
@@ -610,7 +620,7 @@ class InterruptMonitor {
foreach flag $new_flag {
if {[winfo exists $pending_frame.[string tolower $flag]]} {
pack forget $pending_frame.[string tolower $flag]
- } {
+ } else {
create_pending_interrupt $flag
}
}
@@ -626,11 +636,11 @@ class InterruptMonitor {
}
# Adjust colors of flag bits
- foreach flag_bit $avaliable_interrs {
+ foreach flag_bit $available_interrs {
# Determinate new color
if {[intr_mon_getBit $flag_bit]} {
set color $::Simulator_GUI::on_color
- } {
+ } else {
set color $::Simulator_GUI::off_color
}
set flag [string tolower $flag_bit]
@@ -654,13 +664,13 @@ class InterruptMonitor {
if {!$dialog_opened} {return}
# Adjust colors of flag bits
- foreach flag_bit $avaliable_interrs {
+ foreach flag_bit $available_interrs {
set ena_bit [lindex [get_interrupt_details $flag_bit] 1]
# Determinate new color
if {[intr_mon_getBit $ena_bit]} {
set color $::Simulator_GUI::on_color
- } {
+ } else {
set color $::Simulator_GUI::off_color
}
@@ -709,7 +719,7 @@ class InterruptMonitor {
pack [label $secondary_frame.name \
-text [lindex $intr 3] -pady 0 \
-bg $bg_color -fg white \
- -cursor hand1 -anchor w \
+ -cursor hand2 -anchor w \
] -side left -anchor w -fill x -padx 3 -expand 1
bind $secondary_frame.name <Button-1> \
"$this interrupt_monitor_collapse_expand $primary_frame.tertiary"
@@ -725,7 +735,7 @@ class InterruptMonitor {
set tertiary_frame [frame $primary_frame.tertiary -bg {#FFFFFF}]
# Priority:
grid [label $tertiary_frame.priority_lbl \
- -pady 0 -text "Priority:" \
+ -pady 0 -text [mc "Priority:"] \
-bg white -font $lbl_font \
] -sticky w -pady 0 -row 0 -column 0
set pri__clr [get_priority_and_color $flag_bit]
@@ -742,7 +752,7 @@ class InterruptMonitor {
set row 2
set col 0
set pri_bits [lindex $intr 2]
- if {[$this get_feature_avaliable iph]} {
+ if {[$this get_feature_available iph]} {
set pri_bits [linsert $pri_bits 0 "[lindex $intr 2]H"]
}
foreach lbl {
@@ -778,7 +788,7 @@ class InterruptMonitor {
e_bit -
p_bit -
f_bit {
- set cursor {hand1}
+ set cursor {hand2}
set is_bit 1
}
}
@@ -864,7 +874,7 @@ class InterruptMonitor {
pack [label $secondary_frame.name \
-text [lindex $intr 3] -pady 0 \
-bg $bg_color -fg white \
- -cursor hand1 -anchor w \
+ -cursor hand2 -anchor w \
] -side left -anchor w -fill x -padx 3 -expand 1
bind $secondary_frame.name <Button-1> \
"$this interrupt_monitor_collapse_expand $primary_frame.tertiary"
@@ -880,7 +890,7 @@ class InterruptMonitor {
set tertiary_frame [frame $primary_frame.tertiary -bg {#FFFFFF}]
# Priority
grid [label $tertiary_frame.priority_lbl \
- -pady 0 -text "Priority:" \
+ -pady 0 -text [mc "Priority:"] \
-bg white -font $lbl_font \
] -sticky w -pady 0 -row 0 -column 0
set pri__clr [get_priority_and_color $flag_bit]
@@ -897,7 +907,7 @@ class InterruptMonitor {
# Vector, Flag bit, Enable bit, Priority bits
set row 2
set pri_bits [lindex $intr 2]
- if {[$this get_feature_avaliable iph]} {
+ if {[$this get_feature_available iph]} {
set pri_bits [linsert $pri_bits 0 "[lindex $intr 2]H"]
}
foreach lbl {
@@ -932,7 +942,7 @@ class InterruptMonitor {
e_bit -
p_bit -
f_bit {
- set cursor {hand1}
+ set cursor {hand2}
set is_bit 1
}
}
@@ -977,13 +987,13 @@ class InterruptMonitor {
# Invoked from:
set row 2
grid [label $tertiary_frame.lbl__$row \
- -text {Invoked from:} -pady 0 \
+ -text [mc "Invoked from:"] -pady 0 \
-bg white -font $lbl_font \
] -sticky w -row $row -column 3 -pady 0 -columnspan 2
incr row
# PC:
grid [label $tertiary_frame.lbl__$row \
- -pady 0 -text { PC:} \
+ -pady 0 -text [mc " PC:"] \
-bg white -font $lbl_font \
] -sticky w -row $row -column 3 -pady 0
grid [label $tertiary_frame.val__$row \
@@ -993,13 +1003,13 @@ class InterruptMonitor {
incr row
# File:
grid [label $tertiary_frame.lbl__$row \
- -pady 0 -text [mc { File:}] \
+ -pady 0 -text [mc " File:"] \
-bg white -font $lbl_font \
] -sticky w -row $row -column 3 -pady 0
set filename [$this filelist_get_simulator_editor_obj]
if {$filename != {}} {
set filename [$filename cget -fullFileName]
- } {
+ } else {
set filename [lindex [$this simulator_get_list_of_filenames] 0]
}
grid [label $tertiary_frame.val__$row \
@@ -1009,7 +1019,7 @@ class InterruptMonitor {
incr row
# Line:
grid [label $tertiary_frame.lbl__$row \
- -pady 0 -text [mc { Line:}] \
+ -pady 0 -text [mc " Line:"] \
-bg white -font $lbl_font \
] -sticky w -row $row -column 3 -pady 0
grid [label $tertiary_frame.val__$row \
@@ -1024,7 +1034,7 @@ class InterruptMonitor {
set wdg [lindex $in_progress_wdg end]
if {$wdg != {}} {
pack $primary_frame -fill x -before $wdg -pady 2
- } {
+ } else {
pack $primary_frame -fill x -pady 2
}
@@ -1244,3 +1254,7 @@ class InterruptMonitor {
}
}
}
+
+# >>> File inclusion guard
+}
+# <<< File inclusion guard