summaryrefslogtreecommitdiff
path: root/lib/rightpanel
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rightpanel')
-rw-r--r--[-rwxr-xr-x]lib/rightpanel/hwmanager.tcl340
-rw-r--r--[-rwxr-xr-x]lib/rightpanel/instructiondetails.tcl98
-rw-r--r--[-rwxr-xr-x]lib/rightpanel/regwatches.tcl273
-rw-r--r--[-rwxr-xr-x]lib/rightpanel/rightpanel.tcl262
-rw-r--r--[-rwxr-xr-x]lib/rightpanel/subprograms.tcl107
5 files changed, 657 insertions, 423 deletions
diff --git a/lib/rightpanel/hwmanager.tcl b/lib/rightpanel/hwmanager.tcl
index 0e27941..133d821 100755..100644
--- a/lib/rightpanel/hwmanager.tcl
+++ b/lib/rightpanel/hwmanager.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 _HWMANAGER_TCL ] } {
+set _HWMANAGER_TCL _
+# <<< File inclusion guard
+
# --------------------------------------------------------------------------
# DESCRIPTION
# Provides panel for managing hardware plugins (e.g. Programmer, ICD, etc.)
@@ -29,24 +34,26 @@
class HwManager {
## COMMON
common PLUGIN_SEARCH_PATHS {
- ../hwplugins
/usr/share/mcu8051ide/hwplugins
/usr/local/share/mcu8051ide/hwplugins
}
+ if {$::MICROSOFT_WINDOWS} {
+ set PLUGIN_SEARCH_PATHS ${::INSTALLATION_DIR}/hwplugins
+ }
common inst_plg_count 0 ;# Int: Number of installed plugins
## PRIVATE
private variable parent ;# Widget: parent widget
- private variable gui_initialized 0 ;# Bool: GUI initialized
+ private variable hwman_gui_initialized 0 ;# Bool: GUI initialized
private variable main_frame ;# Widget: Main frame
private variable pagesmanager ;# Widget: Pages manager for plugins GUI
private variable plg_combobox ;# Widget: Plugin selection combobox
- private variable plg_refresh_but ;# Widget: Button "Refresh avaliable plugins"
+ private variable plg_refresh_but ;# Widget: Button "Refresh available plugins"
private variable ins_plugin_namespaces {} ;# List of Strings: Namespaces of installed (initialized) plugins
private variable ins_plugin_names {} ;# List of Strings: Names of installed (initialized) plugins
- private variable avl_plugin_files {} ;# List of Strings: Full filenames of avaliable plugins
- private variable avl_plugin_names {} ;# List of Strings: Names of avaliable plugins
+ private variable avl_plugin_files {} ;# List of Strings: Full filenames of available plugins
+ private variable avl_plugin_names {} ;# List of Strings: Names of available plugins
# List: Configuraion list of this panel (for session management)
private variable local_config [lindex $::CONFIG(HW_MANAGER_CONFIG) 0]
@@ -71,7 +78,7 @@ class HwManager {
if {[catch {
${ns}::dispose
- }]} {
+ }]} then {
plugin_error $name $ns
}
}
@@ -83,35 +90,35 @@ class HwManager {
# @return void
public method PrepareHwManager {_parent} {
set parent $_parent
- set gui_initialized 0
+ set hwman_gui_initialized 0
}
## Finalize initialization of this panel
# @return void
public method CreateHwManagerGUI {} {
- if {$gui_initialized} {return}
- set gui_initialized 1
+ if {$hwman_gui_initialized} {return}
+ set hwman_gui_initialized 1
# Create main GUI parts
set main_frame [frame $parent.main_frame]
set top_frame [frame $main_frame.top]
- set pagesmanager [PagesManager $main_frame.pagesmanager -background {#eeeeee}]
+ set pagesmanager [PagesManager $main_frame.pagesmanager -background ${::COMMON_BG_COLOR}]
## Create parts of top panel
# Label "HW"
pack [label $top_frame.plg_label \
-text [mc "HW:"] \
] -side left
- # Combobox of avaliable/installed plugins
+ # Combobox of available/installed plugins
set plg_combobox [ttk::combobox $top_frame.plg_cbbox \
-exportselection 1 \
-width 0 \
-state readonly \
]
- DynamicHelp::add $plg_combobox -text [mc "List avaliable or installed HW plugins"]
+ DynamicHelp::add $plg_combobox -text [mc "List available or installed HW plugins"]
bind $plg_combobox <<ComboboxSelected>> "$this hw_manager_plg_cbs"
pack $plg_combobox -fill x -expand 1 -side left
- setStatusTip -widget $plg_combobox -text [mc "Avaliable/installed plugins"]
+ setStatusTip -widget $plg_combobox -text [mc "available/installed plugins"]
# Button "Refresh"
set plg_refresh_but [ttk::button $top_frame.plg_refresh_but \
-image ::ICONS::16::reload \
@@ -119,7 +126,7 @@ class HwManager {
-style Flat.TButton \
]
DynamicHelp::add $top_frame.plg_refresh_but \
- -text [mc "Refresh list avaliable or installed HW plugins"]
+ -text [mc "Refresh list available or installed HW plugins"]
pack $plg_refresh_but -side left
setStatusTip -widget $plg_refresh_but -text [mc "Refresh"]
# Fill in the combobox
@@ -141,16 +148,16 @@ class HwManager {
pack $main_frame -fill both -expand 1
}
- ## Refresh list avaliable or installed HW plugins
+ ## Refresh list available or installed HW plugins
# @return void
public method hw_manager_refresh_plugins {} {
- if {!$gui_initialized} {CreateHwManagerGUI}
+ if {!$hwman_gui_initialized} {CreateHwManagerGUI}
if {${::CLI_OPTION(no-plugins)}} {return}
set avl_plugin_files [list]
set avl_plugin_names [list]
- # Search for avaliable plugins
+ # Search for available plugins
foreach dir $PLUGIN_SEARCH_PATHS {
set dir [file join ${::LIB_DIRNAME} $dir]
catch { ;# For Microsoft Windows it has to be enclosed by catch
@@ -158,6 +165,7 @@ class HwManager {
if {[lsearch -ascii -exact $avl_plugin_names [file tail [file rootname $file]]] != -1} {
continue
}
+
lappend avl_plugin_files $file
lappend avl_plugin_names [regsub -all {_} [file tail [file rootname $file]] { }]
}
@@ -172,12 +180,12 @@ class HwManager {
# @parm String plugin_name - Plugin to switch to
# @return void
public method hw_manager_switch_plugin {plugin_name} {
- if {!$gui_initialized} {CreateHwManagerGUI}
+ if {!$hwman_gui_initialized} {CreateHwManagerGUI}
if {${::CLI_OPTION(no-plugins)}} {return}
# Install the plugin if it wasn't installed yet
if {[lsearch -ascii -exact $ins_plugin_names $plugin_name] == -1} {
- # Check if the selected plugin is really avaliable
+ # Check if the selected plugin is really available
if {[lsearch -ascii -exact $avl_plugin_names $plugin_name] == -1} {
return
}
@@ -192,15 +200,15 @@ class HwManager {
]
}
- # Adjust the combobox of avaliable/installed plugins
- $pagesmanager raise [regsub -all {\s} $plugin_name {_}]
+ # Adjust the combobox of available/installed plugins
+ $pagesmanager raise [regsub -all {[\s\.]} $plugin_name {_}]
}
- ## "Change command" for the combobox of avaliable/installed plugins
+ ## "Change command" for the combobox of available/installed plugins
# Switches the selected plugin
# @return void
public method hw_manager_plg_cbs {} {
- if {!$gui_initialized} {CreateHwManagerGUI}
+ if {!$hwman_gui_initialized} {CreateHwManagerGUI}
hw_manager_switch_plugin [$plg_combobox get]
}
@@ -209,22 +217,24 @@ class HwManager {
# @parm String file_path - Full path to the plugin main file
# @return String - Plugin namespace
public method hw_manager_install_plugin {plugin_name file_path} {
- if {!$gui_initialized} {CreateHwManagerGUI}
+ if {!$hwman_gui_initialized} {CreateHwManagerGUI}
if {${::CLI_OPTION(no-plugins)}} {return}
set plg_ns {}
if {[catch {
- set frame [$pagesmanager add [regsub -all {\s} $plugin_name {_}]]
+ set frame [$pagesmanager add [regsub -all {[\s\.]} $plugin_name {_}]]
set plg_ns "::HwManager::plugin_ns::$inst_plg_count"
incr inst_plg_count
namespace eval $plg_ns "source {$file_path}"
- set min_ide_ver [subst "\$${plg_ns}::MIN_IDE_VER"]
+ set min_ide_ver [subst -nocommands "\$${plg_ns}::MIN_IDE_VER"]
if {[package vcompare $min_ide_ver $::VERSION] == 1} {
tk_messageBox \
+ -parent . \
-title [mc "Too old version"] \
- -type ok -icon warning \
+ -type ok \
+ -icon warning \
-message [mc "Plugin %s requires MCU 8051 IDE version %s and above, please upgrade your MCU 8051 IDE" $plugin_name $min_ide_ver]
}
@@ -234,7 +244,7 @@ class HwManager {
if {$idx != -1} {
${plg_ns}::restore_session [lindex $plugin_config_1 $idx]
}
- }]} {
+ }]} then {
plugin_error $plugin_name $plg_ns
}
@@ -252,9 +262,9 @@ class HwManager {
set plugin_author {not defined}
set authors_email {not defined}
set err_info $::errorInfo
- catch {set plugin_ver [subst "\$${plugin_ns}::P_VERSION"]}
- catch {set plugin_author [subst "\$${plugin_ns}::AUTHOR"]}
- catch {set authors_email [subst "\$${plugin_ns}::EMAIL"]}
+ catch {set plugin_ver [subst -nocommands "\$${plugin_ns}::P_VERSION"]}
+ catch {set plugin_author [subst -nocommands "\$${plugin_ns}::AUTHOR"]}
+ catch {set authors_email [subst -nocommands "\$${plugin_ns}::EMAIL"]}
# Print error message to stadrad error output
puts stderr "\n\n"
@@ -285,85 +295,87 @@ class HwManager {
close $log_file
}
- # Display GUI error message
- set dialog [toplevel .plugin_error -bg {#EEEEEE}]
-
- # Create window frames
- set main_dlg_frame [frame $dialog.main_frame]
- set top_frame [frame $main_dlg_frame.top_frame -bg {#EE0000}]
- set middle_frame [frame $main_dlg_frame.middle_frame]
- set bottom_frame [frame $main_dlg_frame.bottom_frame]
-
- # Create window header
- pack [label $top_frame.header_lbl \
- -text [mc "PLUGIN ERROR"] \
- -bg {#EE0000} -fg {#FFFFFF} \
- -font [font create \
- -family helvetica \
- -size -24 \
- -weight bold \
- ] \
- ] -side left -fill x -expand 1
-
- # Create error message text and scrollbar
- pack [text $middle_frame.text \
- -bg {white} -bd 0 \
- -yscrollcommand "$middle_frame.scrollbar set" \
- -width 0 -height 0 -relief flat -wrap word \
- ] -side left -fill both -expand 1 -padx 5 -pady 5
- bind $middle_frame.text <Button-1> {focus %W}
- pack [ttk::scrollbar $middle_frame.scrollbar \
- -orient vertical \
- -command "$middle_frame.text yview" \
- ] -fill y -side right
-
- # Create button "Close"
- pack [ttk::button $bottom_frame.ok \
- -text [mc "Close"] \
- -style GreenBg.TButton \
- -command "
+ # Display GUI error message (only if the main window is still visible)
+ if {[wm state .] != {withdrawn}} {
+ set dialog [toplevel .plugin_error -bg ${::COMMON_BG_COLOR}]
+
+ # Create window frames
+ set main_dlg_frame [frame $dialog.main_frame]
+ set top_frame [frame $main_dlg_frame.top_frame -bg {#EE0000}]
+ set middle_frame [frame $main_dlg_frame.middle_frame]
+ set bottom_frame [frame $main_dlg_frame.bottom_frame]
+
+ # Create window header
+ pack [label $top_frame.header_lbl \
+ -text [mc "PLUGIN ERROR"] \
+ -bg {#EE0000} -fg {#FFFFFF} \
+ -font [font create \
+ -family helvetica \
+ -size [expr {int(-24 * $::font_size_factor)}] \
+ -weight bold \
+ ] \
+ ] -side left -fill x -expand 1
+
+ # Create error message text and scrollbar
+ pack [text $middle_frame.text \
+ -bg {white} -bd 0 \
+ -yscrollcommand "$middle_frame.scrollbar set" \
+ -width 0 -height 0 -relief flat -wrap word \
+ ] -side left -fill both -expand 1 -padx 5 -pady 5
+ bind $middle_frame.text <Button-1> {focus %W}
+ pack [ttk::scrollbar $middle_frame.scrollbar \
+ -orient vertical \
+ -command "$middle_frame.text yview" \
+ ] -fill y -side right
+
+ # Create button "Close"
+ pack [ttk::button $bottom_frame.ok \
+ -text [mc "Close"] \
+ -style GreenBg.TButton \
+ -command "
+ grab release $dialog
+ destroy $dialog
+ " \
+ ] -side right
+ focus -force $bottom_frame.ok
+
+ # Display error message
+ $middle_frame.text insert insert [mc "Plugin name:\t%s\n" $plugin_name]
+ $middle_frame.text insert insert [mc "Plugin version:\t%s\n" $plugin_ver]
+ $middle_frame.text insert insert [mc "Author:\t\t%s <%s>\n" $plugin_author $authors_email]
+ $middle_frame.text insert insert "\n"
+ $middle_frame.text insert insert $err_info
+ $middle_frame.text insert insert "\n"
+ $middle_frame.text configure -state disabled
+
+ # Pack window frames
+ pack $top_frame -fill x -anchor n
+ pack $middle_frame -fill both -expand 1
+ pack $bottom_frame -fill x
+ pack $main_dlg_frame -fill both -expand 1 -padx 5 -pady 5
+
+ # Configure dialog window
+ set x [expr {[winfo screenwidth $dialog] / 2 - 225}]
+ set y [expr {[winfo screenheight $dialog] / 2 - 125}]
+ wm iconphoto $dialog ::ICONS::16::bug
+ wm title $dialog [mc "PLUGIN ERROR - MCU 8051 IDE"]
+ wm minsize $dialog 450 250
+ wm geometry $dialog =550x250+$x+$y
+ wm protocol $dialog WM_DELETE_WINDOW "
grab release $dialog
- destroy $dialog
- " \
- ] -side right
- focus -force $bottom_frame.ok
-
- # Display error message
- $middle_frame.text insert insert [mc "Plugin name:\t%s\n" $plugin_name]
- $middle_frame.text insert insert [mc "Plugin version:\t%s\n" $plugin_ver]
- $middle_frame.text insert insert [mc "Author:\t\t%s <%s>\n" $plugin_author $authors_email]
- $middle_frame.text insert insert "\n"
- $middle_frame.text insert insert $err_info
- $middle_frame.text insert insert "\n"
- $middle_frame.text configure -state disabled
-
- # Pack window frames
- pack $top_frame -fill x -anchor n
- pack $middle_frame -fill both -expand 1
- pack $bottom_frame -fill x
- pack $main_dlg_frame -fill both -expand 1 -padx 5 -pady 5
-
- # Configure dialog window
- set x [expr {[winfo screenwidth $dialog] / 2 - 225}]
- set y [expr {[winfo screenheight $dialog] / 2 - 125}]
- wm iconphoto $dialog ::ICONS::16::bug
- wm title $dialog [mc "PLUGIN ERROR - MCU 8051 IDE"]
- wm minsize $dialog 450 250
- wm geometry $dialog =550x250+$x+$y
- wm protocol $dialog WM_DELETE_WINDOW "
- grab release $dialog
- destroy $dialog"
- update
- raise $dialog
- grab $dialog
- wm transient $dialog .
- tkwait window $dialog
+ destroy $dialog"
+ update
+ raise $dialog
+ grab $dialog
+ wm transient $dialog .
+ tkwait window $dialog
+ }
}
## Ask all plugins wheather they are ready for exit
# @return Bool - 1 == Exit allowed; 0 == Exit DENIED
public method hw_manager_comfirm_exit {} {
- if {!$gui_initialized} {return 1}
+ if {!$hwman_gui_initialized} {return 1}
foreach plg_name $ins_plugin_names plg_ns $ins_plugin_namespaces {
set busy_flag 0
@@ -389,7 +401,7 @@ class HwManager {
## Get configuration list for this panel (intented for sessions management)
# @return void
public method hw_manager_get_cfg {} {
- if {!$gui_initialized} {
+ if {!$hwman_gui_initialized} {
return [list $local_config $plugin_config_0 $plugin_config_1]
}
@@ -409,11 +421,125 @@ class HwManager {
if {$idx == -1} {
lappend plugin_config_0 $plg_name
lappend plugin_config_1 $config
- } {
+ } else {
lset plugin_config_1 $idx $config
}
}
return [list $local_config $plugin_config_0 $plugin_config_1]
}
+
+ # ---------------------------------------------------------------------
+ # Functions mend to be accessed from HW control plug-ins
+ # ---------------------------------------------------------------------
+
+ ## Check whether there is some project opened in the IDE
+ # @return Bool - 1 == Yes, there is; 0 == No there is not
+ proc is_project_opened {} {
+ return [expr {!${::X::project_menu_locked}}]
+ }
+
+ ## Check whether MCU simulator is engaged
+ # @return Bool - 0 == 1 == Yes, it is; No it is not (or no project is opened)
+ proc is_simulator_engaged {} {
+ if {[lindex ${::X::simulator_enabled} ${::X::actualProjectIdx}] == 1} {
+ return 1
+ } else {
+ return 0
+ }
+ }
+
+ ## Get full name of file which is currently displayed in the source code editor
+ # @return String - Full file name including path or empty string in case there is no project opened
+ proc get_current_file {} {
+ if {![is_project_opened]} {
+ return {}
+ } else {
+ return [${::X::actualProject} editor_procedure {} getFileName {}]
+ }
+ }
+
+ ## Get full name of file which has been chosen as the project main file
+ # @return String - Full file name or empty string
+ proc get_project_main_file {} {
+ if {![is_project_opened]} {
+ return {}
+ } else {
+ return [${::X::actualProject} cget -P_option_main_file]
+ }
+ }
+
+ ## Get path the directory of currently active project
+ # @return String - Directory path or empty string in case there is no project opened
+ proc get_project_dir {} {
+ if {![is_project_opened]} {
+ return {}
+ } else {
+ return [${::X::actualProject} cget -projectPath]
+ }
+ }
+
+ ## Get name of the current project
+ # @return String - Name of the current project or empty string in case there is no project opened
+ proc get_project_name {} {
+ if {![is_project_opened]} {
+ return {}
+ } else {
+ return [${::X::actualProject} cget -projectName]
+ }
+ }
+
+ ## Initiate compilation if at least one of the source files was modified
+ # @parm String success_callback - Any command to execute after successful compilation
+ # @parm String failure_callback - Any command to execute after unsuccessful compilation
+ # @return Bool - 1 == Process successfully started; 0 == Unable to comply (no project is opened)
+ proc compile_if_nessesary_and_callback {success_callback failure_callback} {
+ if {![is_project_opened]} {
+ return 0
+ }
+
+ ::X::compile_if_nessesary_and_callback $success_callback $failure_callback
+ return 1
+ }
+
+ ## Open the specified Intel® 8 hex file in hexadecimal editor
+ # @parm String filename - Name of file to open (including path)
+ # @return Bool - 1 == Success; 0 == Failure
+ proc open_in_hexeditor {filename} {
+ return [[::X::__hexeditor] open_file $filename hex]
+ }
+
+ ## Start MCU simulator if possible
+ # @return Bool - 1 == Success; 0 == Unable to comply
+ proc start_simulator {} {
+ if {![is_project_opened]} {
+ return 0
+ }
+
+ if {[is_simulator_engaged]} {
+ return 0
+ }
+
+ ::X::__initiate_sim
+ return 1
+ }
+
+ ## Shutdown MCU simulator if possible
+ # @return Bool - 1 == Success; 0 == Unable to comply
+ proc shutdown_simulator {} {
+ if {![is_project_opened]} {
+ return 0
+ }
+
+ if {![is_simulator_engaged]} {
+ return 0
+ }
+
+ ::X::__initiate_sim
+ return 1
+ }
+}
+
+# >>> File inclusion guard
}
+# <<< File inclusion guard
diff --git a/lib/rightpanel/instructiondetails.tcl b/lib/rightpanel/instructiondetails.tcl
index 0c7efaf..88f0206 100755..100644
--- a/lib/rightpanel/instructiondetails.tcl
+++ b/lib/rightpanel/instructiondetails.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 _INSTRUCTIONDETAILS_TCL ] } {
+set _INSTRUCTIONDETAILS_TCL _
+# <<< File inclusion guard
+
# --------------------------------------------------------------------------
# DESCRIPTION
# Implements tab "Instruction details" on the Right Panel
@@ -30,9 +35,12 @@ class InstructionDetails {
## COMMON
# Conter of instances
- common count 0
+ common instd_count 0
# Font for instruction details
- common instruction_font [font create -size -12 -family $::DEFAULT_FIXED_FONT]
+ common instruction_font [font create \
+ -size [expr {int(-12 * $::font_size_factor)}] \
+ -family $::DEFAULT_FIXED_FONT \
+ ]
## Highlighting tags for instruction details
# {
# {tag_name foreground_color ?bold_or_italic?}
@@ -69,13 +77,13 @@ class InstructionDetails {
# }
common HELP_FOR_DIRECTIVES {}
common HELP_FOR_DIRECTIVES_RAW {
- elseif {Conditional assembly\n\nSyntax:\n ELSEIF <expr>\n\nExample:\n IF(2 * 4 - CND)\n MOV A, #20h\n ELSEIF SOMETHING_ELSE\n MOV A, #40h\n ENDIF\n\nNote:\n Supported by ASEM-51 only}
+ elseif {Conditional assembly\n\nSyntax:\n ELSEIF <expr>\n\nExample:\n IF(2 * 4 - CND)\n MOV A, #20h\n ELSEIF SOMETHING_ELSE\n MOV A, #40h\n ENDIF\n\n}
ifn {IF Not, conditional assembly\n\nSyntax:\n IFN <expr>\n\nExample:\n IF(2 * 4 - CND)\n MOV A, #20h\n ELSE\n MOV A, #40h\n ENDIF\n\n}
- elseifn {ELSE IF Not\n\nSyntax:\n ELSEIFN <expr>\n\nExample:\n IF(2 * 4 - CND)\n MOV A, #20h\n ELSEIFN SOMETHING_ELSE\n MOV A, #40h\n ENDIF\n\nNote:\n Supported by ASEM-51 only}
+ elseifn {ELSE IF Not\n\nSyntax:\n ELSEIFN <expr>\n\nExample:\n IF(2 * 4 - CND)\n MOV A, #20h\n ELSEIFN SOMETHING_ELSE\n MOV A, #40h\n ENDIF\n\n}
ifdef {IF DEFined\n\nSyntax:\n IFDEF <symbol>\n\nExample:\n IFDEF CND\n MOV A, #20h\n ELSE\n MOV A, #40h\n ENDIF\n\n}
- elseifdef {ELSE IF DEFined\n\nSyntax:\n ELSEIFDEF <symbol>\n\nExample:\n IFDEF(2 * 4 - CND)\n MOV A, #20h\n ELSEIFDEF SOMETHING_ELSE\n MOV A, #40h\n ENDIF\n\nNote:\n Supported by ASEM-51 only}
+ elseifdef {ELSE IF DEFined\n\nSyntax:\n ELSEIFDEF <symbol>\n\nExample:\n IFDEF(2 * 4 - CND)\n MOV A, #20h\n ELSEIFDEF SOMETHING_ELSE\n MOV A, #40h\n ENDIF\n\n}
ifndef {IF Not DEFined\n\nSyntax:\n IFNDEF <symbol>\n\nExample:\n IFNDEF CND\n MOV A, #20h\n ELSE\n MOV A, #40h\n ENDIF\n\n}
- elseifndef {ELSE IF Not DEFined\n\nSyntax:\n ELSEIFNDEF <symbol>\n\nExample:\n IFDEF CND\n MOV A, #20h\n ELSEIFNDEF SOMETHING_ELSE\n MOV A, #40h\n ENDIF\n\nNote:\n Supported by ASEM-51 only}
+ elseifndef {ELSE IF Not DEFined\n\nSyntax:\n ELSEIFNDEF <symbol>\n\nExample:\n IFDEF CND\n MOV A, #20h\n ELSEIFNDEF SOMETHING_ELSE\n MOV A, #40h\n ENDIF\n\n}
ifb {IF Black\n\nSyntax:\n IFB <literal>\n\nExample:\n IFB <CND>\n MOV A, #20h\n ELSE\n MOV A, #40h\n ENDIF\n\nNote:\n Supported by ASEM-51 only}
elseifb {ELSE IF Black\n\nSyntax:\n ELSEIFB <literal>\n\nExample:\n IFB <CND>\n MOV A, #20h\n ELSEIFB <SOMETHING_ELSE>\n MOV A, #40h\n ENDIF\n\literal:\n Supported by ASEM-51 only}
ifnb {IF Not Black\n\nSyntax:\n IFNB <literal>\n\nExample:\n IFNB <CND>\n MOV A, #20h\n ELSE\n MOV A, #40h\n ENDIF\n\nNote:\n Supported by ASEM-51 only}
@@ -96,11 +104,12 @@ class InstructionDetails {
bseg {switch to BIT segment \[at address\]\n\nSyntax:\n BSEG \[AT <expr>\]\n\nExample:\n BSEG at 5d\n\n}
xseg {switch to XDATA segment \[at address\]\n\nSyntax:\n XSEG \[AT <expr>\]\n\nExample:\n XSEG at 30d\n\n}
cseg {switch to CODE segment \[at address\]\n\nSyntax:\n CSEG \[AT <expr>\]\n\nExample:\n CSEG at 40d\n\n}
+ local {define a local label inside a macro\n\nSyntax:\n LOCAL <symbol>\n\nExample:\n ABC MACRO\n LOCAL xyz\n xyz: MOV B, #12d\n EXITM\n NOP\n ENDM\n\n}
flag {define a FLAG bit\n\nSyntax:\n <symbol> FLAG <expr>\n\nExample:\n F4 FLAG 16h\n\nNote:\n Deprecated directive. Consider directive BIT instead.}
skip {SKIP bytes in the code memory\n\nSyntax:\n SKIP <expr>\n\nExample:\n SKIP 5\n\n}
equ {EQUivalent\n\nSyntax:\n <symbol> EQU <expr>\n\nExample:\n ABC EQU R0\n XYZ EQU 4Eh+12\n\n}
bit {define BIT address\n\nSyntax:\n <symbol> BIT <expr>\n\nExample:\n ABC BIT P4.5\n\n}
- set {SET numeric variable or variable register\n\nSyntax:\n <symbol> SET <expr>\n <symbol> SET <register>\n\nExample:\n ALPHA SET R0\N ALPHA SET 42*BETA\n\n}
+ set {SET numeric variable or variable register\n\nSyntax:\n <symbol> SET <expr>\n <symbol> SET <register>\n\nExample:\n ALPHA SET R0\n ALPHA SET 42*BETA\n\n}
code {define address in the CODE memory\n\nSyntax:\n <symbol> CODE <expr>\n\nExample:\n TBL CODE 600h\n\n}
data {define address in the DATA memory\n\nSyntax:\n <symbol> DATA <expr>\n\nExample:\n UIV DATA 20h\n\n}
idata {define address in the Internal DATA memory\n\nSyntax:\n <symbol> IDATA <expr>\n\nExample:\n UIV IDATA 20h\n\n}
@@ -111,7 +120,7 @@ class InstructionDetails {
db {Define Bytes\n\nSyntax:\n DB <expr1> \[,<expr2> ... \]\n\nExample:\n DB 24,'August',09,(2*8+24)/8\n\n}
dbit {Define BITs\n\nSyntax:\n DBIT <expr>\n\nExample:\n DBIT 4+2\n\n}
include {INCLUDE an external source code\n\nSyntax:\n INCLUDE <filename>\n\nExample:\n INCLUDE 'my file.asm'\n\n}
- org {ORiGin of segment location\n\nSyntax:\n ORG <expr>\n\nExample:\n ORG 0Bh\n\n}
+ org {ORiGin of code segment location\n\nSyntax:\n ORG <expr>\n\nExample:\n ORG 0Bh\n\n}
using {USING register banks\n\nSyntax:\n USING <expr>\n\nExample:\n USING 2\n\n}
byte {define BYTE address in the data memory\n\nSyntax:\n <symbol> BYTE <expr>\n\nExample:\n UIV BYTE 20h\n\nNote:\n Deprecated directive. Consider directive DATA instead.}
@@ -875,7 +884,7 @@ class InstructionDetails {
private variable header_text ;# Widget: Text header
private variable instruction_last {} ;# String: Last instruction shown in details window
private variable parent {} ;# Widget: GUI parent
- private variable gui_initialized 0 ;# Bool: GUI initialized
+ private variable instd_gui_initialized 0 ;# Bool: GUI initialized
private variable gui_preparing 0 ;# Bool: Prearing panel GUI
private variable enabled 0 ;# Bool: enable procedures which are needless while loading project
@@ -886,11 +895,11 @@ class InstructionDetails {
private variable ins_help_window {} ;# Widget: Help window itself
private variable help_win_title ;# Widget: Title label (should contain instruction name and operands)
## Array of Widgets: Labels containing certain information
- # Avaliable keys are: description, length, execution_time, opcode, note and class
+ # available keys are: description, length, execution_time, opcode, note and class
private variable help_win_labels
constructor {} {
- incr count
+ incr instd_count
}
destructor {
@@ -901,13 +910,13 @@ class InstructionDetails {
# @return void
public method PrepareInstructionDetails {_parent} {
set parent $_parent
- set gui_initialized 0
+ set instd_gui_initialized 0
}
## Create GUI of tab "Instruction details"
# @return void
public method CreateInstructionDetailsGUI {} {
- if {$gui_initialized || $gui_preparing || ${::Editor::editor_to_use}} {return}
+ if {$instd_gui_initialized || $gui_preparing || ${::Editor::editor_to_use}} {return}
set gui_preparing 1
# Create frames
@@ -929,10 +938,14 @@ class InstructionDetails {
# Tab header (instruction name)
set instruction_label [label $header_frame.lbl_rightPanel_instruction_header \
- -fg {#0000FF} \
- -anchor w \
- -padx {20px} \
- -font [font create -weight {bold} -size -17 -family $::DEFAULT_FIXED_FONT] \
+ -fg {#0000FF} \
+ -anchor w \
+ -padx {20px} \
+ -font [font create \
+ -weight {bold} \
+ -size [expr {int(-17 * $::font_size_factor)}] \
+ -family $::DEFAULT_FIXED_FONT \
+ ] \
]
pack $instruction_label -side left -fill x -expand 1
setStatusTip -widget $instruction_label -text [mc "Instruction name"]
@@ -940,7 +953,7 @@ class InstructionDetails {
# Create popup menu for instruction text and its header
set instruction_menu [menu $text_frame.popup_menu -tearoff 0]
$instruction_menu add command -label "Configure" -compound left \
- -command {::configDialogs::rightPanel::mkDialog 1} \
+ -command {::configDialogues::rightPanel::mkDialog 1} \
-underline 0 -image ::ICONS::16::configure
# Text header
@@ -951,6 +964,7 @@ class InstructionDetails {
-height 1 \
-bd 0 \
-exportselection 0 \
+ -wrap none \
]
bind $header_text <ButtonRelease-3> "tk_popup $instruction_menu %X %Y; break"
bind $header_text <Key-Menu> "tk_popup $instruction_menu %X %Y; break"
@@ -959,7 +973,7 @@ class InstructionDetails {
# Instruction details text
set instruction_text [text $text_frame.txt_rightPanel_instruction \
-yscrollcommand "$body_frame.src_rightPanel_instruction set" \
- -cursor left_ptr -state disabled -wrap word \
+ -cursor left_ptr -state disabled -wrap none \
-font $instruction_font -bd 0 -exportselection 0 \
]
# Create scrollbar
@@ -979,7 +993,10 @@ class InstructionDetails {
$instruction_text tag configure tag_sel0 -background #E0FFE0
rightPanel_refresh_instruction_highlighting
$instruction_text tag configure tag_bold -font [font create \
- -size -12 -family $::DEFAULT_FIXED_FONT -weight {bold}]
+ -size [expr {int(-12 * $::font_size_factor)}] \
+ -family $::DEFAULT_FIXED_FONT \
+ -weight {bold} \
+ ]
# Pack parts of text frame (Instruction details text, Text header)
pack $header_text -side top -fill x
@@ -990,7 +1007,7 @@ class InstructionDetails {
pack $header_frame -side top -fill x
pack $body_frame -side bottom -fill both -expand 1
- set gui_initialized 1
+ set instd_gui_initialized 1
}
## Invoke legend window for "Instruction details"
@@ -1006,7 +1023,7 @@ class InstructionDetails {
set y [winfo pointery .]
# Create legend window
- set win [toplevel .rightPanel_legend -class {Help} -bg {#EEEEEE}]
+ set win [toplevel .rightPanel_legend -class {Help} -bg ${::COMMON_BG_COLOR}]
set frame [frame $win.f -bg {#555555} -bd 0 -padx 1 -pady 1]
wm overrideredirect $win 1
@@ -1152,7 +1169,8 @@ class InstructionDetails {
# @return void
public method rightPanel_ins_clear {} {
if {!$enabled || ${::Editor::editor_to_use}} {return}
- if {!$gui_initialized} {CreateInstructionDetailsGUI}
+ if {!$instd_gui_initialized} {CreateInstructionDetailsGUI}
+
$instruction_text configure -state normal
$instruction_text delete 1.0 end
$instruction_text configure -state disabled
@@ -1167,7 +1185,7 @@ class InstructionDetails {
# @return void
public method rightPanel_refresh_instruction_highlighting {} {
if {${::Editor::editor_to_use}} {return}
- if {!$gui_initialized && !$gui_preparing} {return}
+ if {!$instd_gui_initialized && !$gui_preparing} {return}
$this right_panel_create_highlighting_tags \
$instruction_text $instruction_tags 0
}
@@ -1176,12 +1194,12 @@ class InstructionDetails {
# @return void
public method rightPanel_ins_unselect {} {
if {!$enabled || ${::Editor::editor_to_use}} {return}
- if {!$gui_initialized} {return}
+ if {!$instd_gui_initialized} {return}
$instruction_text tag remove tag_sel 1.0 end
if {$::CONFIG(VALIDATION_LEVEL) == 2} {
$instruction_label configure -fg {#FF0000}
- } {
+ } else {
$instruction_label configure -fg {#0000FF}
}
}
@@ -1192,12 +1210,12 @@ class InstructionDetails {
# @return void
public method rightPanel_ins_select {perfect_match list_of_indexes} {
if {!$enabled || ${::Editor::editor_to_use}} {return}
- if {!$gui_initialized} {return}
+ if {!$instd_gui_initialized} {return}
if {[$instruction_label cget -text] == {}} {return}
$instruction_label configure -fg {#0000FF}
if {$perfect_match} {
set tag tag_sel
- } {
+ } else {
set tag tag_sel0
}
foreach line $list_of_indexes {
@@ -1213,7 +1231,7 @@ class InstructionDetails {
# @return void
public method rightPanel_dir_change {type directive} {
if {!$enabled || ${::Editor::editor_to_use}} {return}
- if {!$gui_initialized} {return}
+ if {!$instd_gui_initialized} {return}
regsub {^\.} $directive {} directive
set directive [string tolower $directive]
@@ -1225,7 +1243,7 @@ class InstructionDetails {
# Change content of tab header
if {$type == {D}} {
set clr {#00AADD}
- } {
+ } else {
set clr {#00AADD}
}
set dir_up [string toupper $directive]
@@ -1239,7 +1257,7 @@ class InstructionDetails {
set idx [lsearch -ascii -exact $HELP_FOR_DIRECTIVES $directive]
if {$idx == -1} {
$instruction_text insert end [mc "no help available for this directive"]
- } {
+ } else {
incr idx
$instruction_text insert end [lindex $HELP_FOR_DIRECTIVES $idx]
}
@@ -1259,7 +1277,7 @@ class InstructionDetails {
# @return void
public method rightPanel_ins_change {instruction} {
if {!$enabled || ${::Editor::editor_to_use}} {return}
- if {!$gui_initialized} {return}
+ if {!$instd_gui_initialized} {return}
set instruction [string tolower $instruction]
if {$instruction_last == $instruction} {return}
@@ -1333,7 +1351,7 @@ class InstructionDetails {
if {[string index $opr 0] == {@}} {
$instruction_text tag add tag_indr $startIndex insert-1c
# SFR
- } {
+ } else {
$instruction_text tag add tag_SFR $startIndex insert-1c
}
}
@@ -1580,15 +1598,19 @@ class InstructionDetails {
## Create instruciton help window
# @return void
private method create_ins_help_window {} {
+ if {$ins_help_win_created} {
+ return
+ }
set ins_help_win_created 1
# Create main parts of the window
- set ins_help_window [frame .ins_help_window${count} -bd 0 -bg {#BBBBFF} -padx 2 -pady 2]
+ incr instd_count
+ set ins_help_window [frame .ins_help_window${instd_count} -bd 0 -bg {#BBBBFF} -padx 2 -pady 2]
pack [frame $ins_help_window.top -bg {#BBBBFF}] -fill x -expand 1
pack [label $ins_help_window.top.img -bg {#BBBBFF} -image ::ICONS::16::info] -side left
pack [label $ins_help_window.top.tit -bg {#BBBBFF} -justify left -anchor w] -side left -fill x -expand 1
pack [frame $ins_help_window.msg -bg {#FFFFFF} -padx 10 -pady 5] -fill both -expand 1
- set help_win_title "$ins_help_window.top.tit"
+ set help_win_title "${ins_help_window}.top.tit"
## Create other parts of the window
# Descripton
@@ -1753,3 +1775,7 @@ class InstructionDetails {
# Initialize
::InstructionDetails::initialize
+
+# >>> File inclusion guard
+}
+# <<< File inclusion guard
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
diff --git a/lib/rightpanel/rightpanel.tcl b/lib/rightpanel/rightpanel.tcl
index 061f1f5..81bbb37 100755..100644
--- a/lib/rightpanel/rightpanel.tcl
+++ b/lib/rightpanel/rightpanel.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 _RIGHTPANEL_TCL ] } {
+set _RIGHTPANEL_TCL _
+# <<< File inclusion guard
+
# --------------------------------------------------------------------------
# DESCRIPTION
# Implements Right Panel
@@ -42,8 +47,6 @@ class RightPanel {
inherit RegWatches InstructionDetails SubPrograms HwManager
## COMMON
- # Conter of instances
- common count 0
# Background color for selected rows -- light
common selection_color {#EEFFDD}
# Background color for selected rows -- dark
@@ -60,9 +63,9 @@ class RightPanel {
{button_cancel} "Add/Remove editor bookmark to/from current line"}
{separator}
{command {Previous} {} 0 "rightPanel_bm_up" {1uparrow}
- "Goto previous bookmark"}
+ "Go to previous bookmark"}
{command {Next} {} 0 "rightPanel_bm_up" {1downarrow}
- "Goto next bookmark"}
+ "Go to next bookmark"}
{separator}
{command {Remove all} {} 0 "editor_procedure {} clear_all_bookmarks {}"
{editdelete} "Remove all bookmarks from the editor"}
@@ -73,9 +76,9 @@ class RightPanel {
{button_cancel} "Add/Remove editor breakpoint to/from current line"}
{separator}
{command {Previous} {} 0 "rightPanel_bp_up" {1uparrow}
- "Goto previous breakpoint"}
+ "Go to previous breakpoint"}
{command {Next} {} 0 "rightPanel_bp_up" {1downarrow}
- "Goto next breakpoint"}
+ "Go to next breakpoint"}
{separator}
{command {Remove all} {} 0 "editor_procedure {} clear_all_breakpoints {}"
{editdelete} "Remove all breakpoints from the editor"}
@@ -95,8 +98,8 @@ class RightPanel {
private variable table_of_symbols ;# ID of tab "Table of symbols"
private variable obj_idx ;# Number of this object
- private variable bookmarks_menu ;# ID of popup menu for "Bookmarks"
- private variable breakpoints_menu ;# ID of popup menu for "Breakpoints"
+ private variable bookmarks_menu {} ;# ID of popup menu for "Bookmarks"
+ private variable breakpoints_menu {} ;# ID of popup menu for "Breakpoints"
private variable symbols_menu ;# ID of popup menu for "Symbol list"
private variable bm_pagesManager ;# ID of pages manager for tab "Bookmarks"
@@ -148,8 +151,6 @@ class RightPanel {
## Object constructor
constructor {} {
- incr count
- set obj_idx $count
}
## Object destructor
@@ -167,7 +168,7 @@ class RightPanel {
# @parm Widget ParentPane - parent paned window
# @parm String watches_file - definition file for register watches
# @return void
- public method Initialize_rightPanel {notebookframe ParentPane watches_file} {
+ public method initialize_rightPanel {notebookframe ParentPane watches_file} {
# Object variables
set parentPane $ParentPane ;# Parent container (some frame)
@@ -175,10 +176,7 @@ class RightPanel {
set notebook_frame $notebookframe
## Create NoteBook
- set notebook [NoteBook $notebook_frame.ntb_rightPanel \
- -side top -bg {#EEEEEE} \
- -arcradius 4 \
- ]
+ set notebook [ModernNoteBook $notebook_frame.ntb_rightPanel]
# Register notebook status bar tips
notebook_Sbar_set {rightpanel} [list \
@@ -200,57 +198,57 @@ class RightPanel {
if {!${::Editor::editor_to_use}} {
# Tab "Bookmarks"
- set bookmarks [$notebook insert end [mc "Bookmarks"] \
- -image ::ICONS::16::bookmark_toolbar \
- -raisecmd "$this rightPanel_set_active_page Bookmarks" \
- -helptext [mc "List of bookmarks in editor (Ctrl+6)"] \
+ set bookmarks [$notebook insert end {Bookmarks} \
+ -image ::ICONS::16::bookmark_toolbar \
+ -raisecmd [list $this rightPanel_set_active_page Bookmarks] \
+ -helptext [mc "List of bookmarks in editor (Ctrl+6)"] \
]
# Tab "Breakpoints"
- set breakpoints [$notebook insert end [mc "Breakpoints"] \
+ set breakpoints [$notebook insert end {Breakpoints} \
-image ::ICONS::16::flag \
- -raisecmd "$this rightPanel_set_active_page Breakpoints" \
+ -raisecmd [list $this rightPanel_set_active_page Breakpoints] \
-helptext [mc "List of breakpoints in editor (Ctrl+7)"] \
]
# Tab "Symbols"
- set table_of_symbols [$notebook insert end [mc "Symbols"] \
- -image ::ICONS::16::_blockdevice \
- -raisecmd "$this rightPanel_set_active_page Symbols" \
- -helptext [mc "Symbol List"] \
+ set table_of_symbols [$notebook insert end {Symbols} \
+ -image ::ICONS::16::_blockdevice \
+ -raisecmd [list $this rightPanel_set_active_page Symbols] \
+ -helptext [mc "Symbol List"] \
]
# Tab "Instruction"
- set instruction [$notebook insert end [mc "Instruction"] \
- -image ::ICONS::16::info \
- -raisecmd "$this rightPanel_set_active_page Instruction" \
- -helptext [mc "Instruction details (Ctrl+8)"] \
- -createcmd [list $this CreateInstructionDetailsGUI] \
+ set instruction [$notebook insert end {Instruction} \
+ -image ::ICONS::16::info \
+ -raisecmd [list $this rightPanel_set_active_page Instruction] \
+ -helptext [mc "Instruction details (Ctrl+8)"] \
+ -createcmd [list $this CreateInstructionDetailsGUI] \
]
}
# Tab "Watches"
- set watches [$notebook insert end [mc "Watches"] \
- -image ::ICONS::16::player_playlist \
- -raisecmd "$this rightPanel_set_active_page Watches" \
- -helptext [mc "Register watches (Ctrl+9)"] \
- -createcmd [list $this CreateRegWatchesGUI] \
+ set watches [$notebook insert end {Watches} \
+ -image ::ICONS::16::player_playlist \
+ -raisecmd [list $this rightPanel_set_active_page Watches] \
+ -helptext [mc "Register watches (Ctrl+9)"] \
+ -createcmd [list $this CreateRegWatchesGUI] \
]
# Tab "Subprograms"
- set subprograms [$notebook insert end [mc "Subprograms"] \
- -image ::ICONS::16::queue \
- -raisecmd "$this rightPanel_set_active_page Subprograms"\
- -helptext [mc "Active subprograms (Ctrl+0)"] \
- -createcmd [list $this CreateSubProgramsGUI] \
+ set subprograms [$notebook insert end {Subprograms} \
+ -image ::ICONS::16::queue \
+ -raisecmd [list $this rightPanel_set_active_page Subprograms] \
+ -helptext [mc "Active subprograms (Ctrl+0)"] \
+ -createcmd [list $this CreateSubProgramsGUI] \
]
# Tab "Hardware manager"
- set hwmanager [$notebook insert end [mc "Hardware"] \
- -image ::ICONS::16::kcmpci \
- -raisecmd "$this rightPanel_set_active_page Hardware" \
- -helptext [mc "Hardware manager"] \
- -createcmd [list $this CreateHwManagerGUI] \
+ set hwmanager [$notebook insert end {Hardware} \
+ -image ::ICONS::16::kcmpci \
+ -raisecmd [list $this rightPanel_set_active_page Hardware] \
+ -helptext [mc "Hardware manager"] \
+ -createcmd [list $this CreateHwManagerGUI] \
]
# Tab "Hide"
- $notebook insert end [mc "Hide"] \
- -image ::ICONS::16::2rightarrow \
- -raisecmd "$this right_panel_show_hide" \
+ $notebook insert end {Hide} \
+ -image ::ICONS::16::2rightarrow \
+ -raisecmd [list $this right_panel_show_hide] \
-helptext [mc "Hide the panel"]
# Prepare panel componenets but do not create GUI elements
@@ -262,7 +260,6 @@ class RightPanel {
PrepareInstructionDetails $instruction
}
-
## Create Button bar
# Button "Show"
set button_bar [frame $notebook_frame.button_bar]
@@ -347,15 +344,15 @@ class RightPanel {
if {!${::Editor::editor_to_use}} {
# Pack pages managers
- set bm_pagesManager [PagesManager $bookmarks.pgm_rightPanel_bm -background {#eeeeee}]
+ set bm_pagesManager [PagesManager $bookmarks.pgm_rightPanel_bm -background ${::COMMON_BG_COLOR}]
pack $bm_pagesManager -expand 1 -fill both
$bm_pagesManager compute_size
- set bp_pagesManager [PagesManager $breakpoints.pgm_rightPanel_pm -background {#eeeeee}]
+ set bp_pagesManager [PagesManager $breakpoints.pgm_rightPanel_pm -background ${::COMMON_BG_COLOR}]
pack $bp_pagesManager -expand 1 -fill both
$bp_pagesManager compute_size
- set sm_pagesManager [PagesManager $table_of_symbols.sm_pagesManager -background {#eeeeee}]
+ set sm_pagesManager [PagesManager $table_of_symbols.sm_pagesManager -background ${::COMMON_BG_COLOR}]
pack $sm_pagesManager -expand 1 -fill both
$sm_pagesManager compute_size
@@ -363,9 +360,9 @@ class RightPanel {
set bookmarks_menu $notebook_frame.menu_rightPanel_bookmarks
set breakpoints_menu $notebook_frame.menu_rightPanel_breakpoints
set symbols_menu $notebook_frame.menu_rightPanel_symbols
- menuFactory $BREAKPOINTMENU $breakpoints_menu 0 "$this " 0 {}
- menuFactory $BOOKMARKMENU $bookmarks_menu 0 "$this " 0 {}
- menuFactory $SYMBOLSKMENU $symbols_menu 0 "$this " 0 {}
+ menuFactory $BREAKPOINTMENU $breakpoints_menu 0 "$this " 0 {} [namespace current]
+ menuFactory $BOOKMARKMENU $bookmarks_menu 0 "$this " 0 {} [namespace current]
+ menuFactory $SYMBOLSKMENU $symbols_menu 0 "$this " 0 {} [namespace current]
}
@@ -379,7 +376,7 @@ class RightPanel {
if {$PanelVisible} {
# Show NoteBook
$parentPane paneconfigure $notebook_frame -minsize 295
- pack $notebook -expand 1 -fill both
+ pack [$notebook get_nb] -expand 1 -fill both -padx 5 -pady 5
$parentPane configure -sashwidth 2
if {[catch {
@@ -387,15 +384,15 @@ class RightPanel {
if {
${::Editor::editor_to_use} &&
([lsearch {Bookmarks Breakpoints Instruction Symbols} $active_page] != -1)
- } {
+ } then {
set active_page {Watches}
$notebook raise {Watches}
}
- }]} {
+ }]} then {
set active_page {Watches}
$notebook raise {Watches}
}
- } {
+ } else {
# Show button bar
$parentPane paneconfigure $notebook_frame -minsize 0
pack $button_bar -anchor nw
@@ -413,7 +410,7 @@ class RightPanel {
# @return void
public method rightPanel_scroll args {
# Local variables
- set what [lindex $args 0]
+ set what [lindex $args 0] ;# m == Bookmarks; p == Breakpoints; s == Symbols
set cmd [lindex $args 1] ;# Scroll command (moveto, scroll and such)
set frac [lindex $args 2] ;# Fraction where to move
set units [lindex $args 3] ;# Units (optonal)
@@ -436,7 +433,7 @@ class RightPanel {
if {$units == {}} {
$lnb yview $cmd $frac
$txt yview $cmd $frac
- } {
+ } else {
$lnb yview $cmd $frac $units
$txt yview $cmd $frac $units
}
@@ -470,7 +467,7 @@ class RightPanel {
if {[winfo ismapped $scrollbar]} {
pack forget $scrollbar
}
- } {
+ } else {
if {![winfo ismapped $scrollbar]} {
pack $scrollbar -side right -fill y -after $txt
}
@@ -490,11 +487,11 @@ class RightPanel {
public method rightPanel_refresh_font_settings {for_all} {
if {${::Editor::editor_to_use}} {return}
if {$for_all} {
- foreach widget $LIST_bookmarks_lineNumbers {
+ foreach widget $LIST_bookmarks_lineNumbers {
$widget configure -font ${Editor::defaultFont_bold}
}
- foreach widget $LIST_breakpoints_lineNumbers {
+ foreach widget $LIST_breakpoints_lineNumbers {
$widget configure -font ${Editor::defaultFont_bold}
}
@@ -527,7 +524,7 @@ class RightPanel {
}
incr i
}
- } {
+ } else {
$bookmarks_lineNumbers configure -font ${Editor::defaultFont_bold}
$bookmarks_text configure -font ${Editor::defaultFont_bold}
$breakpoints_lineNumbers configure -font ${Editor::defaultFont_bold}
@@ -574,7 +571,7 @@ class RightPanel {
# @return void
private method create_tags_in_symbol_list {} {
set tags_to_define [list tag_label tag_constant tag_normal tag_macro]
- foreach tag_def [concat ${::ASMsyntaxHighlight::hightlight_tags} ${::CsyntaxHighlight::hightlight_tags}] {
+ foreach tag_def [concat ${::ASMsyntaxHighlight::highlight_tags} ${::CsyntaxHighlight::highlight_tags}] {
if {[lsearch -ascii -exact $tags_to_define [lindex $tag_def 0]] == -1} {
continue
}
@@ -591,13 +588,13 @@ class RightPanel {
# Fonr slant
if {$tag_def_item(3) == 1} {
set tag_def_item(3) italic
- } {
+ } else {
set tag_def_item(3) roman
}
# Font weight
if {$tag_def_item(4) == 1} {
set tag_def_item(4) bold
- } {
+ } else {
set tag_def_item(4) normal
}
@@ -667,7 +664,7 @@ class RightPanel {
pack $bm_up_button -side left
DynamicHelp::add $bm_up_button -text [mc "Move to previous bookmark"]
setStatusTip -widget $bm_up_button \
- -text [mc "Goto to line of previous bookmark"]
+ -text [mc "Go to to line of previous bookmark"]
# Button "Down"
set bm_down_button [ttk::button $button_frame.but_rightPanel_bm_down \
-image ::ICONS::16::1downarrow \
@@ -678,7 +675,7 @@ class RightPanel {
pack $bm_down_button -side left
DynamicHelp::add $bm_down_button -text [mc "Move to the next bookmark"]
setStatusTip -widget $bm_down_button \
- -text [mc "Goto to line of next bookmark"]
+ -text [mc "Go to to line of next bookmark"]
# Separator
pack [ttk::separator $button_frame.but_rightPanel_bm_sep \
-orient vertical \
@@ -773,7 +770,7 @@ class RightPanel {
pack $bp_up_button -side left
DynamicHelp::add $bp_up_button -text [mc "Move to previous breakpoint"]
setStatusTip -widget $bp_up_button \
- -text [mc "Goto to line of previous breakpoint"]
+ -text [mc "Go to to line of previous breakpoint"]
# Button "Down"
set bp_down_button [ttk::button $button_frame.but_rightPanel_bp_down \
-image ::ICONS::16::1downarrow \
@@ -784,7 +781,7 @@ class RightPanel {
pack $bp_down_button -side left
DynamicHelp::add $bp_down_button -text [mc "Move to next breakpoint"]
setStatusTip -widget $bp_down_button \
- -text [mc "Goto to line of next breakpoint"]
+ -text [mc "Go to to line of next breakpoint"]
# Separator
pack [ttk::separator $button_frame.but_rightPanel_bp_sep \
-orient vertical \
@@ -1021,8 +1018,8 @@ class RightPanel {
if {[winfo exists $breakpoints_menu]} {destroy $breakpoints_menu}
if {[winfo exists $bookmarks_menu]} {destroy $bookmarks_menu}
- menuFactory $BREAKPOINTMENU $breakpoints_menu 0 "$this " 0 {}
- menuFactory $BOOKMARKMENU $bookmarks_menu 0 "$this " 0 {}
+ menuFactory $BREAKPOINTMENU $breakpoints_menu 0 "$this " 0 {} [namespace current]
+ menuFactory $BOOKMARKMENU $bookmarks_menu 0 "$this " 0 {} [namespace current]
}
## Invoke bookmarks popup menu
@@ -1208,7 +1205,7 @@ class RightPanel {
# Change current line in the editor
set block_select 1
$this editor_procedure {} goto $lineNum
- update idle
+ update idletasks
set block_select 0
return 1
@@ -1236,8 +1233,32 @@ class RightPanel {
return $lineNum
}
+ ## If the given line contain symbol declaration then select it in the list
+ # This function should be called after change on the line in the editor
+ # @parm Int lineNum - line number
+ # @return Bool - result
+ public method rightPanel_sm_select {lineNum} {
+ if {!$enabled || $block_select} {return}
+ if {![info exists sm_text]} {return}
+
+ # Unset selection in the list
+ $sm_text tag remove curLine 1.0 end
+
+ # Check for bookmark presence
+ set idx0 [lsearch -ascii -exact [$sm_lineNumbers get 1.0 end] $lineNum]
+ if {$idx0 == -1} {return 0}
+
+ # Select the line
+ incr idx0
+ set idx1 $idx0
+ incr idx1
+ $sm_text tag add curLine $idx0.0 $idx1.0
+ $sm_text see $idx0.0
+ return 1
+ }
+
## If the given line contain bookmark then select it in the list
- # This function should be called after change line in the editor
+ # This function should be called after change on the line in the editor
# @parm Int lineNum - line number
# @return Bool - result
public method rightPanel_bm_select {lineNum} {
@@ -1259,7 +1280,7 @@ class RightPanel {
}
## If the given line contain bookmark then select it in the list
- # This function should be called after change line in the editor
+ # This function should be called after change on the line in the editor
# @parm Int lineNum - line number
# @return Bool - result
public method rightPanel_bp_select {lineNum} {
@@ -1267,7 +1288,7 @@ class RightPanel {
if {![info exists breakpoints_text]} {return}
# Check for bookmark presence
- set idx0 [lsearch [$breakpoints_lineNumbers get 1.0 end] $lineNum]
+ set idx0 [lsearch -ascii -exact [$breakpoints_lineNumbers get 1.0 end] $lineNum]
if {$idx0 == -1} {return 0}
# Select the line
@@ -1316,7 +1337,7 @@ class RightPanel {
if {$idx == {end}} {
set row [$target_widget index end]
set row [expr {int($row) - 2}]
- } {
+ } else {
set row [expr {int($idx)}]
}
# Iterate over source text tags and add them to target widget
@@ -1363,7 +1384,7 @@ class RightPanel {
if {$idx == -1} {
set idx {end}
- } {
+ } else {
append idx {.0}
}
@@ -1439,7 +1460,7 @@ class RightPanel {
if {$idx == -1} {
set idx {end}
- } {
+ } else {
append idx {.0}
}
@@ -1690,7 +1711,7 @@ class RightPanel {
if {$start_idx == {}} {
if {[lindex $lineNumbers end] != $end_line} {
return
- } {
+ } else {
set start_idx 1.0
}
}
@@ -1764,7 +1785,7 @@ class RightPanel {
if {$start_idx == {}} {
if {[lindex $lineNumbers end] != $end_line} {
return
- } {
+ } else {
set start_idx 1.0
}
}
@@ -1842,7 +1863,7 @@ class RightPanel {
return 1
# Not empty string
- } {
+ } else {
$clr_b configure -state normal
}
@@ -1850,15 +1871,16 @@ class RightPanel {
set content [string toupper $content]
set e [expr {int([$sm_text index insert])}]
for {set i 1} {$i < $e} {incr i} {
- if {![string first $content [string toupper [$sm_text get $i.0 [list $i.0 lineend]]]]} {
+ if {![string first $content [string toupper [$sm_text get $i.2 [list $i.0 lineend]]]]} {
$widget configure -style StringFound.TEntry
$sm_text tag remove curLine 1.0 end
- $sm_text tag add curLine [list $i.0 linestart] [list $i.0+1l linestart]
+ $sm_text tag add curLine $i.0 [list $i.0+1l linestart]
+ $sm_text see $i.0
set block_select 1
- $this editor_procedure {} goto $i
- update idle
+ $this editor_procedure {} goto [$sm_lineNumbers get $i.0 [list $i.0 lineend]]
+ update idletasks
set block_select 0
set search_val_in_progress 0
return 1
@@ -1880,7 +1902,15 @@ class RightPanel {
# 3 - Macro
# @parm Bool add__remove - 1 == Add; 0 == Remove
# @return void
- public method rightPanel_adjust_symbol_list {lineNum symbol_name symbol_type add__remove} {
+ public method rightPanel_adjust_symbol_list {lineNum symbol_name symbol_type add__remove {editor_object {}}} {
+ if {[$this is_splitted] && $editor_object != {}} {
+ set idx [lsearch -ascii -exact [$this cget -editors] $editor_object]
+
+ if {$idx != $current_editor_idx} {
+ rightPanel_switch_editor_vars $idx
+ }
+ }
+
$sm_lineNumbers configure -state normal
$sm_text configure -state normal
@@ -1900,47 +1930,59 @@ class RightPanel {
if {$idx == -1} {
set idx [$sm_text index {end-1l}]
- } {
+ } else {
append idx {.0}
}
- $sm_lineNumbers insert $idx "$lineNum\n"
- $sm_text insert $idx "$symbol_name\n"
-
switch -- $symbol_type {
0 { ;# Label
set tag {tag_label}
+ set icon {symbol1}
}
1 { ;# Constant
set tag {tag_constant}
+ set icon {symbol3}
}
2 { ;# C variable
set tag {tag_normal}
+ set icon {symbol4}
}
3 { ;# Macro
set tag {tag_macro}
+ set icon {symbol2}
}
7 { ;# C function
set tag {tag_c_func}
+ set icon {symbol0}
}
default {
set tag {}
+ set icon {symbol5}
}
}
+ $sm_lineNumbers insert $idx "$lineNum\n"
+
+ if {${::Editor::defaultCharHeight} < 16} {
+ $sm_text insert ${idx} { }
+ } else {
+ $sm_text image create $idx -image ::ICONS::16::$icon
+ }
+ $sm_text insert ${idx}+1c " $symbol_name\n"
+
if {$tag != {}} {
$sm_text tag add $tag $idx [list $idx lineend]
}
# Remove symbol
- } {
+ } else {
if {$lineNum == {all}} {
set idx [list]
set e [expr {int([$sm_lineNumbers index end]) - 1}]
for {set i 0} {$i < $e} {incr i} {
lappend idx $i
}
- } {
+ } else {
set idx [lsearch -all [$sm_lineNumbers get 1.0 end] $lineNum]
}
@@ -1949,7 +1991,7 @@ class RightPanel {
}
foreach i $idx {
incr i
- if {[string equal [$sm_text get $i.0 [list $i.0 lineend]] $symbol_name]} {
+ if {[string equal [$sm_text get $i.2 [list $i.0 lineend]] $symbol_name]} {
$sm_text delete $i.0 $i.0+1l
$sm_lineNumbers delete $i.0 $i.0+1l
break
@@ -2080,7 +2122,7 @@ class RightPanel {
# This function takes any list of arguments
# @return void
public method rightPanel_configure args {
- ::configDialogs::rightPanel::mkDialog $args
+ ::configDialogues::rightPanel::mkDialog $args
}
## Return true if this panel is in visible state
@@ -2092,7 +2134,7 @@ class RightPanel {
public method getRightPanelSize {} {
if {$PanelVisible} {
return $PanelSize
- } {
+ } else {
return $last_PanelSize
}
}
@@ -2108,7 +2150,7 @@ class RightPanel {
if {$PanelVisible} {
$parentPane paneconfigure $notebook_frame -minsize 0
- pack forget $notebook ;# Hide notebook
+ pack forget [$notebook get_nb] ;# Hide notebook
set last_PanelSize $PanelSize ;# Save current panel width
set PanelSize 60 ;# Change panel width
right_panel_redraw_pane ;# Redraw panel
@@ -2122,7 +2164,7 @@ class RightPanel {
set PanelVisible 0
# Show the panel
- } {
+ } else {
$parentPane paneconfigure $notebook_frame -minsize 295
# Hide button bar
@@ -2131,7 +2173,7 @@ class RightPanel {
set PanelSize $last_PanelSize
right_panel_redraw_pane
$notebook raise $active_page
- pack $notebook -expand 1 -fill both
+ pack [$notebook get_nb] -expand 1 -fill both
# Show pane sash
$parentPane configure -sashwidth 2
bind $parentPane <Button> {}
@@ -2180,7 +2222,7 @@ class RightPanel {
}
}
- ## Set panel width acording to current sash position
+ ## Set panel width according to current sash position
# @return void
public method right_panel_set_size {} {
set PanelSize [lindex [$parentPane sash coord 0] 0]
@@ -2214,10 +2256,10 @@ class RightPanel {
set size $fontSize
} elseif {$use_editor_font == -1} {
set font $::DEFAULT_FIXED_FONT
- set size -14
- } {
+ set size [expr {int(-14 * $::font_size_factor)}]
+ } else {
set font $::DEFAULT_FIXED_FONT
- set size -12
+ set size [expr {int(-12 * $::font_size_factor)}]
}
# Iterate over tags definition
@@ -2234,7 +2276,7 @@ class RightPanel {
-weight {bold} \
-slant {roman}]
# Italic font
- } {
+ } else {
$widget tag configure [lindex $tag 0] \
-foreground [lindex $tag 1] \
-font [font create -size $size \
@@ -2244,7 +2286,7 @@ class RightPanel {
}
# No bold, no italic
- } {
+ } else {
$widget tag configure [lindex $tag 0] \
-foreground [lindex $tag 1] \
-font [font create -size $size \
@@ -2271,3 +2313,7 @@ class RightPanel {
$this right_panel_instruction_details_set_enabled $enabled
}
}
+
+# >>> File inclusion guard
+}
+# <<< File inclusion guard
diff --git a/lib/rightpanel/subprograms.tcl b/lib/rightpanel/subprograms.tcl
index 6385266..c8380cb 100755..100644
--- a/lib/rightpanel/subprograms.tcl
+++ b/lib/rightpanel/subprograms.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 _SUBPROGRAMS_TCL ] } {
+set _SUBPROGRAMS_TCL _
+# <<< File inclusion guard
+
# --------------------------------------------------------------------------
# DESCRIPTION
# Provides panel for watching subprogram calls
@@ -30,29 +35,31 @@ class SubPrograms {
## COMMON
common fsd_filename {} ;# Filename choosen by FSD
# Main font for the text widget
- common main_font [font create \
- -family {helvetica} \
- -size -14 \
+ common main_font [font create \
+ -family {helvetica} \
+ -size [expr {int(-14 * $::font_size_factor)}] \
]
# Bold font for the text widget
- common bold_font [font create \
- -family {helvetica} \
- -size -14 -weight {bold} \
+ common bold_font [font create \
+ -family {helvetica} \
+ -size [expr {int(-14 * $::font_size_factor)}] \
+ -weight {bold} \
]
# Font for status bar below the text box
- common large_font [font create \
- -family {helvetica} \
- -size -14 \
+ common large_font [font create \
+ -family {helvetica} \
+ -size [expr {int(-14 * $::font_size_factor)}] \
]
# Bold font for status bar below the text box
- common large_bold_font [font create \
- -family {helvetica} \
- -size -14 -weight {bold} \
+ common large_bold_font [font create \
+ -family {helvetica} \
+ -size [expr {int(-14 * $::font_size_factor)}] \
+ -weight {bold} \
]
## PRIVATE
private variable parent ;# Widget: parent widget
- private variable gui_initialized 0 ;# Bool: GUI initialized
+ private variable subp_gui_initialized 0 ;# Bool: GUI initialized
private variable text_widget ;# Widget: Text widget containg almost all the information
private variable scrollbar ;# Widget: Scrollbar for the text widget
@@ -73,7 +80,7 @@ class SubPrograms {
}
destructor {
- if {$gui_initialized} {
+ if {$subp_gui_initialized} {
menu_Sbar_remove $menu
}
}
@@ -84,7 +91,7 @@ class SubPrograms {
# @return void
public method PrepareSubPrograms {_parent} {
set parent $_parent
- set gui_initialized 0
+ set subp_gui_initialized 0
load_config $::CONFIG(SUBP_MON_CONFIG)
}
@@ -117,8 +124,8 @@ class SubPrograms {
## Create all widgets which this panel consist of
# @return void
private method create_gui {} {
- if {$gui_initialized} {return}
- set gui_initialized 1
+ if {$subp_gui_initialized} {return}
+ set subp_gui_initialized 1
# Create top frame (checkbuttons)
set top_frame [frame $parent.top]
@@ -136,12 +143,12 @@ class SubPrograms {
# Adjust check buttons
if {$enabled} {
$enable_chbut select
- } {
+ } else {
$enable_chbut deselect
}
if {$ena_intr} {
$intr_chbut select
- } {
+ } else {
$intr_chbut deselect
}
@@ -153,7 +160,7 @@ class SubPrograms {
-image ::ICONS::16::button_cancel \
-command "$this subprograms_force_return" \
-state disabled \
- -width 6 \
+ -width 7 \
]
set clear_but [ttk::button $button_frame.clear_but \
-text [mc "Clear"] \
@@ -244,7 +251,7 @@ class SubPrograms {
{separator}
{command {Remove this} {} 0 "subprograms_menu_action 4"
{editdelete} "Remove this entry"}
- } $menu 0 "$this " 0 {}
+ } $menu 0 "$this " 0 {} [namespace current]
}
## Create highlighting tags for the text widget
@@ -365,7 +372,7 @@ class SubPrograms {
$this Simulator_sync_PC_etc
$this move_simulator_line $line
# Simulator is not running
- } {
+ } else {
set filename [$this simulator_get_filename [lindex $line 1]]
set filename [file tail $filename]
if {[$this fucus_specific_editor $filename 0]} {
@@ -373,7 +380,7 @@ class SubPrograms {
}
}
# Line unresolved
- } {
+ } else {
tk_messageBox \
-parent . \
-title [mc "Line not found"] \
@@ -397,10 +404,10 @@ class SubPrograms {
set line [expr {$line / 3}]
if {$line >= $count} {
set state {disabled}
- } {
+ } else {
set state {normal}
}
- } {
+ } else {
set state {disabled}
}
@@ -426,7 +433,7 @@ class SubPrograms {
# @return void
public method subprograms_call {type from to} {
if {!$enabled} {return}
- if {!$gui_initialized} CreateSubProgramsGUI
+ if {!$subp_gui_initialized} CreateSubProgramsGUI
# Determinate string to print as an instruction
switch -- $type {
@@ -444,7 +451,7 @@ class SubPrograms {
# Convert value of source address to hexadecimal representation
if {$from < 0} {
set from {-----}
- } {
+ } else {
set from [format %X $from]
set len [string length $from]
if {$len < 4} {
@@ -456,7 +463,7 @@ class SubPrograms {
# Convert value of target address to hexadecimal representation
if {$to < 0} {
set to {-----}
- } {
+ } else {
set to [format %X $to]
set len [string length $to]
if {$len < 4} {
@@ -504,7 +511,7 @@ class SubPrograms {
private method disena_buttonbar {bool} {
if {$bool} {
set state {normal}
- } {
+ } else {
set state {disabled}
}
$return_but configure -state $state
@@ -519,7 +526,7 @@ class SubPrograms {
if {!$enabled} {return}
if {!$count} {return}
if {$intr__sub && !$ena_intr} {return}
- if {!$gui_initialized} CreateSubProgramsGUI
+ if {!$subp_gui_initialized} CreateSubProgramsGUI
$text_widget configure -state normal
$text_widget delete 1.0 4.0
@@ -536,7 +543,7 @@ class SubPrograms {
## Clear the text widget
# @return void
public method subprograms_clear {} {
- if {!$gui_initialized} {return}
+ if {!$subp_gui_initialized} {return}
set count 0
$total_val_lbl configure -text 0
$text_widget configure -state normal
@@ -549,7 +556,7 @@ class SubPrograms {
# @parm Bool bool - 1 == Enable; 0 == Disbale
# @return void
public method subprograms_setEnabled {bool} {
- if {!$gui_initialized} {return}
+ if {!$subp_gui_initialized} {return}
if {!$bool} {
$return_but configure -state disabled
}
@@ -565,7 +572,7 @@ class SubPrograms {
set word [string trim $word]
if {$word == {Interrupt}} {
set word 1
- } {
+ } else {
set word 0
}
$this simulator_return_from_SP $word
@@ -581,10 +588,10 @@ class SubPrograms {
KIFSD::FSD fsd \
-title [mc "Save file - MCU 8051 IDE"] \
-directory [$this cget -projectPath] \
- -defaultmask 0 -multiple 0 -filetypes {
- {{Plain text} {*.txt} }
- {{All files} {*} }
- }
+ -defaultmask 0 -multiple 0 -filetypes [list \
+ [list [mc "Plain text"] {*.txt} ] \
+ [list [mc "All files"] {*} ] \
+ ]
# Ok button
fsd setokcmd {
@@ -593,12 +600,12 @@ class SubPrograms {
if {![regexp "^(~|/)" $fsd_filename]} {
set filename "[${::X::actualProject} cget -ProjectDir]/$fsd_filename"
}
- } { ;# Microsoft windows way
- if {![regexp "^\w:" $fsd_filename]} {
+ } else { ;# Microsoft windows way
+ if {![regexp {^\w:} $fsd_filename]} {
set filename [file join [${::X::actualProject} cget -ProjectDir] $fsd_filename]
}
}
-
+
set ::SubPrograms::fsd_filename [file normalize $fsd_filename]
}
@@ -627,7 +634,7 @@ class SubPrograms {
-title [mc "Overwrite file"] \
-message [mc "A file name '%s' already exists. Are you sure you want to overwrite it ?" [file tail $filename]]
] != {yes}
- } {
+ } then {
return
}
# Create a backup file
@@ -637,8 +644,8 @@ class SubPrograms {
}
# Try to open the file
if {[catch {
- set file [open $filename w 420]
- }]} {
+ set file [open $filename w 0640]
+ }]} then {
tk_messageBox \
-parent . \
-icon warning \
@@ -655,14 +662,14 @@ class SubPrograms {
## Get number of recorder active subprograms
# @return Int - Count
public method subprograms_get_count {} {
- if {!$gui_initialized} {return 0}
+ if {!$subp_gui_initialized} {return 0}
return $count
}
## Get content for purpose of program hibernation
# @return String - Text
- public method subprograms_get_formated_content {} {
- if {!$gui_initialized} {return {}}
+ public method subprograms_get_formatted_content {} {
+ if {!$subp_gui_initialized} {return {}}
set result {}
set source {}
set target {}
@@ -684,7 +691,7 @@ class SubPrograms {
regexp {\w+\s*$} $line source
set source [string range $source 0 3]
set source [expr "0x$source"]
- } {
+ } else {
regexp {\w+\s*$} $line target
set target [string range $target 0 3]
set target [expr "0x$target"]
@@ -702,3 +709,7 @@ class SubPrograms {
return $result
}
}
+
+# >>> File inclusion guard
+}
+# <<< File inclusion guard