summaryrefslogtreecommitdiff
path: root/lib/X.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/X.tcl')
-rw-r--r--[-rwxr-xr-x]lib/X.tcl3079
1 files changed, 1976 insertions, 1103 deletions
diff --git a/lib/X.tcl b/lib/X.tcl
index 0875d3d..26cfb7f 100755..100644
--- a/lib/X.tcl
+++ b/lib/X.tcl
@@ -1,8 +1,8 @@
-#!/usr/bin/tclsh
+#!/usr/bin/wish
# Part of MCU 8051 IDE ( http://mcu8051ide.sf.net )
############################################################################
-# Copyright (C) 2007-2009 by Martin Ošmera #
+# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 by Martin Ošmera #
# martin.osmera@gmail.com #
# #
# This program is free software; you can redistribute it and#or modify #
@@ -21,14 +21,19 @@
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
############################################################################
+# >>> File inclusion guard
+if { ! [ info exists _X_TCL ] } {
+set _X_TCL _
+# <<< File inclusion guard
+
# --------------------------------------------------------------------------
# DESCRIPTION
-# "Provides various dialogs and various variables for various things"
+# "Provides various dialogues and various variables for various things"
# For instance the "Go to" dialog is placed here
# --------------------------------------------------------------------------
# Dialog for selecting MCU and loading MCU details from definition file
-source "${::LIB_DIRNAME}/dialogs/selectmcu.tcl"
+source "${::LIB_DIRNAME}/dialogues/selectmcu.tcl"
namespace eval X {
@@ -43,7 +48,7 @@ namespace eval X {
variable project_menu_locked 1 ;# Bool: Indicates than there is at least one opened project
if {!$::MICROSOFT_WINDOWS} {
variable defaultDirectory ${::env(HOME)} ;# Default directory
- } {
+ } else {
variable defaultDirectory ${::env(USERPROFILE)} ;# Default directory
}
variable simulator_enabled {} ;# List of booleans: Simulator engaged
@@ -51,13 +56,13 @@ namespace eval X {
variable fsd_result {} ;# Value returnded by file selection dialog (in some cases)
variable projectmenu {.project_menu} ;# ID of Popup menu for project tabs
variable projectmenu_project {} ;# Object: project selected by project popup menu
- variable selectedView ;# Int: Selected editor by editor statusbar popup menu
+ variable selectedView ;# Object: Selected editor by editor statusbar popup menu
variable open_f_external_editor 0 ;# Bool: Use procedure __open to open new file for embedded external editor
variable file_recent_files {} ;# List: recently opened files
variable project_recent_files {} ;# List: recently opened projects
variable vhw_recent_files {} ;# List: recently opened Virtual HW files
# List of supported processors
- variable avaliable_processors [::SelectMCU::get_avaliable_processors]
+ variable available_processors [::SelectMCU::get_available_processors]
variable procedure_exit_in_progress 0 ;# Bool: proc "__exit" in progress
## Doxygen
@@ -69,11 +74,14 @@ namespace eval X {
## ASCII chart
variable ascii_chart_win_object {} ;# Object: ASCII chart window object
- ## 8-segment LED editor
+ ## Interactive 8051 instruction table
+ variable table_of_instructions_object {} ;# Object: Interactive 8051 instruction table
+
+ ## 8-Segment LED editor
variable eightsegment_editors {} ;# List: All 8-segment LED display editors invoked
- ## Base convertor
- variable base_convertors {} ;# List: All base convertor objects
+ ## Base converter
+ variable base_converters {} ;# List: All base converter objects
## Special calculator
variable spec_calc_objects {} ;# List: All special calculator objects
@@ -81,6 +89,14 @@ namespace eval X {
## UART/RS232 debugger
variable rs232debugger_objects {} ;# List: All "RS232 debugger" objects
+ ## LCD display controlled by HD44780
+ variable vhw_HD44780_rect ;# Array: Rectangles in dialog "Set display size"
+ variable vhw_HD44780_canvas ;# Widget: Canvas widget in dialog "Set display size"
+ variable vhw_HD44780_counter 0 ;# Int: Counter of dialog instances
+ variable vhw_HD44780_size_lbl ;# Widget: Label showing the LCD size in dialog "Set display size"
+ variable vhw_HD44780_dialog ;# Widget: Toplevel window of dialog "Set display size"
+ variable vhw_HD44780_size {0 0} ;# List of Int: LCD display size chosen by the user, {HEIGHT WIDTH}
+
## Dialog "Go to"
variable goto ;# Line where to go
@@ -98,7 +114,7 @@ namespace eval X {
variable find_option_sel ;# Bool: Search only in the seleted text
variable find_option_reg ;# Bool: Consider search string to be a regular expression
variable find_allow_selection ;# Bool: There is some selected text in editor
- variable find_retry_search ;# Bool: Search restarted from begining/end
+ variable find_retry_search ;# Bool: Search restarted from beginning/end
variable find_back_dir ;# Bool: Search backwards (real option)
variable find_history {} ;# List of the last 10 search strings
variable find_next_prev_in_P 0 ;# Bool: Procedure 'find_next_prev' in progress
@@ -121,8 +137,8 @@ namespace eval X {
variable select_directory_var {} ;# Selected directory
## Dialog "New project"
- variable project_new_name ;# Name of the new project
- variable project_new_dir ;# Directory of the new project
+ variable project_new_name {} ;# Name of the new project
+ variable project_new_dir {} ;# Directory of the new project
## Variable common for "New project" and "Edit project"
variable project_new_processor ;# Processor type (e.g. "8051")
@@ -142,7 +158,7 @@ namespace eval X {
variable project_edit_version ;# Project version
variable project_edit_date ;# Project date (last update)
variable project_edit_copyright ;# Copyright information
- variable project_edit_licence ;# Licence information
+ variable project_edit_license ;# License information
variable project_edit_authors ;# Project authors
variable project_edit_description ;# Project description
variable project_edit_clock ;# Default clock rate
@@ -172,19 +188,19 @@ namespace eval X {
variable compilation_success_callback {} ;# String: Indented for HW plugins
variable compilation_fail_callback {} ;# String: Indented for HW plugins
variable compilation_mess_project {} ;# Object: Project related to running compilation
- variable compilation_successfull 1 ;# Bool: Compilation successfull
+ variable compilation_successfull 1 ;# Bool: Compilation successful
variable compilation_in_progress 0 ;# Bool: Compiler engaged
variable compilation_progress 0 ;# Variable for compilation progressbar
variable compiler_pid 0 ;# Int: PID of external compiler if used
variable compilation_start_simulator 0 ;# Bool: Start simulator after successful compilation
variable compile_this_file_only 0 ;# Bool: Compile the current file only
- ## Dialog "Select input/uotput file"
+ ## Dialog "Select input/output file"
variable input_file ;# Input file
variable output_file ;# Output file
variable IO ;# Bool: 1 == choose input file; 0 == choose output file
- ### Dialogs "Hex->Bin; Bin->Hex; Sim->Hex; Sim->Bin; Nomalize Hex"
+ ### Dialogues "Hex->Bin; Bin->Hex; Sim->Hex; Sim->Bin; Nomalize Hex"
# Type of conversion
# 0 == Bin -> Hex
# 1 == Hex -> Bin
@@ -193,15 +209,15 @@ namespace eval X {
variable hex__bin
## XDATA/CODE/ERAM/EEPROM/UNI memory hexadecimal editors
- variable opended_code_mem_windows {} ;# List of project object with opened CODE memory hex editor
+ variable opened_code_mem_windows {} ;# List of project object with opened CODE memory hex editor
variable code_mem_window_objects {} ;# List of CODE memory hex editor objects
- variable opended_xdata_mem_windows {} ;# List of project object with opened XDATA memory hex editor
+ variable opened_xdata_mem_windows {} ;# List of project object with opened XDATA memory hex editor
variable xdata_mem_window_objects {} ;# List of XDATA memory hex editor objects
- variable opended_eram_windows {} ;# List of project object with opened ERAM hex editor
+ variable opened_eram_windows {} ;# List of project object with opened ERAM hex editor
variable eram_window_objects {} ;# List of ERAM hex editor objects
- variable opended_eeprom_mem_windows {} ;# List of project object with opened data EEPROM hex editor
+ variable opened_eeprom_mem_windows {} ;# List of project object with opened data EEPROM hex editor
variable eeprom_mem_window_objects {} ;# List of data EEPROM hex editor objects
- variable opended_eeprom_wr_bf_windows {} ;# List of project objects with opened data EEPROM write buffer editor
+ variable opened_eeprom_wr_bf_windows {} ;# List of project objects with opened data EEPROM write buffer editor
variable eeprom_wr_bf_window_objects {} ;# List of data EEPROM write buffer hex editor objects
variable eeprom_wr_buf_counter 0 ;# Counter of EEPROM write buffer hex editor objects
variable saving_progress 0 ;# Variable for progressbars representing saving progress
@@ -226,6 +242,7 @@ namespace eval X {
*.adf *.adb *.rel *.cdb *.mem *.lnk *.sym
*.omf *.rst *.hashes *bak
}
+ variable cleanup_files {} ;# List: Files marked for potential removal
## Dialog "Change letter case"
variable change_letter_case_options ;# Options (which fields should be adjusted)
@@ -247,7 +264,7 @@ namespace eval X {
variable PROJECTDETAILSWIN ;# ID of project details window
variable projectdetails_last_project {} ;# Project object of the last project details window
- ## Cutom commands related variables
+ ## Custom commands related variables
variable custom_cmd_dialog_index 0 ;# Index of results dialog (to keep win IDs unique)
variable custom_command_cmd ;# Array of custom commands (shell scripts)
variable custom_command_options ;# Array of Lists of custom command options
@@ -259,11 +276,23 @@ namespace eval X {
## Initialize custom commands related variables
# Shell scripts
set custom_command_cmd(0) [mc "echo \"This is a custom command\"\necho \"\tYou can configure it in Main menu->Configure->Edit user commands.\"\necho \"\tCustom commands are intended for running external programs from this IDE (e.g. program uploaders)\""]
- append custom_command_cmd(0) "\n\necho \"\nThis is a custom command\"\necho \"\tYou can configure it in Main menu->Configure->Edit user commands.\"\necho \"\tCustom commands are intended for running external programs from this IDE (e.g. program uploaders)\""
+
+ append custom_command_cmd(0) "\n\n"
+ append custom_command_cmd(0) "echo \"\"\n"
+ append custom_command_cmd(0) "echo \"%%URIS == \\\"%URIS\\\"\"\n"
+ append custom_command_cmd(0) "echo \"%%URI == \\\"%URI\\\"\"\n"
+ append custom_command_cmd(0) "echo \"%%directory == \\\"%directory\\\"\"\n"
+ append custom_command_cmd(0) "echo \"%%filename == \\\"%filename\\\"\"\n"
+ append custom_command_cmd(0) "echo \"%%basename == \\\"%basename\\\"\"\n"
+ append custom_command_cmd(0) "echo \"%%mainfile == \\\"%mainfile\\\"\"\n"
+ append custom_command_cmd(0) "echo \"%%line == \\\"%line\\\"\"\n"
+ append custom_command_cmd(0) "echo \"%%column == \\\"%column\\\"\"\n"
+ append custom_command_cmd(0) "echo \"%%selection == \\\"%selection\\\"\"\n"
+
set custom_command_cmd(1) $custom_command_cmd(0)
set custom_command_cmd(2) $custom_command_cmd(0)
# Command options
- set custom_command_options(0) {0 1 0}
+ set custom_command_options(0) {0 1 0 0}
set custom_command_options(1) $custom_command_options(0)
set custom_command_options(2) $custom_command_options(0)
# Command descritpions
@@ -321,7 +350,7 @@ namespace eval X {
"Compile this file"}
}
}
- # Menu bar items which are not avaliable when editor is in read only mode
+ # Menu bar items which are not available when editor is in read only mode
variable mainmenu_editor_readonly {
{ ".mainMenu.edit"
{ "Undo" "Redo" "Cut" "Paste" "Replace"
@@ -330,13 +359,13 @@ namespace eval X {
{ "Auto indent" "Change letter case" "Document current function"}
}
}
- # Menu bar items which are not avaliable only for C language
+ # Menu bar items which are not available only for C language
variable mainmenu_editor_c_only {
{ ".mainMenu.tools"
{ "Document current function"}
}
}
- # Menu bar items which are not avaliable when external embedded editor is used
+ # Menu bar items which are not available when external embedded editor is used
variable mainmenu_editor_external_na {
{.mainMenu.tools {
{Encoding} {End of line}
@@ -365,40 +394,52 @@ namespace eval X {
# Toolbar buttons which require opened project
variable toolbar_project_dependent_buttons {
- new open save save_as save_all close close_all undo redo cut
- copy paste find findnext findprev replace goto reload clear
- proj_save proj_edit proj_close proj_close_imm show_code_mem
- show_ext_mem start_sim reset step stepover animate run
- assemble disasm reformat_code toHTML toLaTeX cleanup custom0
- custom1 custom2 change_case forward back clear_hg intrmon
- hibernate resume stepback find_sim_cur line2addr show_exp_mem
- sfrmap show_eeprom show_eem_wr_b stopwatch bitmap
-
- ledpanel leddisplay ledmatrix mleddisplay simplekeypad
- matrixkeypad vhw_open vhw_load vhw_save vhw_saveas
- vhw_remove_all
-
- stack
+ new open save save_as
+ save_all close close_all undo
+ redo cut copy paste
+ find findnext findprev replace
+ goto reload clear proj_save
+ proj_edit proj_close proj_close_imm show_code_mem
+ show_ext_mem start_sim reset step
+ stepover animate run assemble
+ disasm reformat_code toHTML toLaTeX
+ cleanup custom0 custom1 custom2
+ change_case forward back clear_hg
+ intrmon hibernate resume stepback
+ find_sim_cur line2addr show_exp_mem sfrmap
+ show_eeprom show_eem_wr_b stopwatch bitmap
+ uartmon
+
+ ledpanel leddisplay ledmatrix mleddisplay
+ simplekeypad matrixkeypad vhw_open vhw_load
+ vhw_save vhw_saveas vhw_remove_all hd44780
+ ds1620 vuterm fintr
+
+ stack d52
}
# Toolbar buttons which require ENGAGED simulator
variable toolbar_simulator_engaged {
- reset step stepover animate run clear_hg
- find_sim_cur line2addr stepback hibernate resume
+ reset step stepover animate
+ run clear_hg find_sim_cur line2addr
+ stepback hibernate resume
}
# Toolbar buttons which require DISENGAGED simulator
variable toolbar_simulator_disengaged {
- new open close close_all undo redo cut
- copy paste replace reload assemble start_sim0
- disasm reformat_code change_case assemble0
+ new open close close_all
+ undo redo cut copy
+ paste replace reload assemble
+ start_sim0 disasm reformat_code change_case
+ assemble0 d52
}
- # Toolbar items which are not avaliable when editor is in read only mode
+ # Toolbar items which are not available when editor is in read only mode
variable toolbar_editor_readonly {
- undo redo cut paste replace reformat_code change_case
+ undo redo cut paste
+ replace reformat_code change_case
}
- # Toolbar items which are not avaliable only for C language
+ # Toolbar items which are not available only for C language
variable toolbar_editor_c_only {
}
- # Toolbar items which are not avaliable when external embedded editor is used
+ # Toolbar items which are not available when external embedded editor is used
variable toolbar_editor_external_na {
save save_as undo redo cut
copy paste find findnext findprev
@@ -439,7 +480,7 @@ namespace eval X {
{command "Move to end" "" 9
{__project_move_to_end}
"2rightarrow" "Move this tab to right the end of the tab bar"}
- } $projectmenu 0 "::X::" 0 {}
+ } $projectmenu 0 "::X::" 0 {} [namespace current]
}
## Switch current project
@@ -471,9 +512,10 @@ namespace eval X {
adjust_title
$actualProject adjust_compiler_settings
+ $actualProject switchfile
}
- ## Enable / Disable menu and toolbar item acording to current state of current project
+ ## Enable / Disable menu and toolbar item according to current state of current project
# @return void
proc disaena_menu_toolbar_for_current_project {} {
variable project_menu_locked ;# Bool: Indicates than there is at least one opened project
@@ -490,13 +532,16 @@ namespace eval X {
# Enable / Disabled stepback buttons
stepback_button_set_ena [$actualProject simulator_get_SBS_len]
- } {
+ } else {
Lock_simulator_menu
adjust_mainmenu_and_toolbar_to_editor \
${::editor_RO_MODE} \
[expr {1 == [$actualProject editor_procedure {} get_language {}]}]
}
+ # set MCU name in statusbar, kdb
+ .statusbarMCU configure -text [$actualProject cget -P_option_mcu_type]
+
## Disable/Enable menu+toolbar entries related to simulator controls which depends on current MCU
disena_simulator_menu $actualProject
}
@@ -546,8 +591,9 @@ namespace eval X {
if {[lindex $simulator_enabled $actualProjectIdx] == 1} {
if {$message} {
- tk_messageBox \
- -title [mc "Unable to compile"] \
+ tk_messageBox \
+ -parent . \
+ -title [mc "Unable to comply"] \
-icon info \
-type ok \
-message [mc "Simulator is engaged, shutdown the simulator first."]
@@ -586,9 +632,9 @@ namespace eval X {
}
## Open file
- # @parm Bool = 0 - 1 == New file (for embedded external editor); 0 == Open an existing file
+ # @parm Bool p_open_f_external_editor=0 - 1 == New file (for embedded external editor); 0 == Open an existing file
# @return void
- proc __open args {
+ proc __open {{p_open_f_external_editor 0}} {
variable actualProject ;# Object: Current project
variable actualProjectIdx ;# Index of the current project in $openedProjects
variable critical_procedure_in_progress ;# Bool: Disables procedures which takes a long time
@@ -603,13 +649,11 @@ namespace eval X {
set critical_procedure_in_progress 1
# Parse input arguments
- set open_f_external_editor [lindex $args 0]
- if {$open_f_external_editor != 1} {
- set title [mc "Open file - MCU 8051 IDE"]
- set open_f_external_editor 0
- } {
+ set open_f_external_editor $p_open_f_external_editor
+ if {$open_f_external_editor} {
set title [mc "New file - MCU 8051 IDE"]
- set open_f_external_editor 1
+ } else {
+ set title [mc "Open file - MCU 8051 IDE"]
}
# Invoke the file selection dialog
@@ -640,11 +684,11 @@ namespace eval X {
foreach filename [X::fsd get] {
if {!$::MICROSOFT_WINDOWS} { ;# POSIX way
if {![regexp "^(~|/)" $filename]} {
- set filename "[${X::actualProject} cget -ProjectDir]/$filename"
+ set filename "[${::X::actualProject} cget -ProjectDir]/$filename"
}
- } { ;# Microsoft windows way
- if {![regexp "^\w:" $filename]} {
- set filename [file join [${X::actualProject} cget -ProjectDir] $filename]
+ } else { ;# Microsoft windows way
+ if {![regexp {^\w:} $filename]} {
+ set filename [file join [${::X::actualProject} cget -ProjectDir] $filename]
}
}
set filename [file normalize $filename]
@@ -661,32 +705,34 @@ namespace eval X {
# Open the specified file
if {${::X::open_f_external_editor} || [file exists $filename]} {
- if {[${X::actualProject} openfile $filename 1 \
+ if {[${::X::actualProject} openfile $filename 1 \
[X::fsd get_window_name] def def 0 0 {}] != {}
- } {
- ${X::actualProject} switch_to_last
- update idle
- ${X::actualProject} editor_procedure {} parseAll {}
+ } then {
+ ${::X::actualProject} switch_to_last
+ update idletasks
+ ${::X::actualProject} editor_procedure {} parseAll {}
# Make LST read only
if {[file extension $filename] == {.lst}} {
set ::editor_RO_MODE 1
- ${X::actualProject} switch_editor_RO_MODE
+ ${::X::actualProject} switch_editor_RO_MODE
}
::X::recent_files_add 1 $filename
}
- } {
- ${X::actualProject} editor_new
- ${X::actualProject} save_as $filename
+
+ } else {
if {!${::Editor::editor_to_use}} {
tk_messageBox \
-type ok \
-icon warning \
- -parent [::X::fsd get_window_name] \
+ -parent . \
-title [mc "File not found - MCU 8051 IDE"] \
-message [mc "The selected file do not exist:\n%s" $filename]
}
+
+ ${::X::actualProject} editor_new
+ ${::X::actualProject} save_as $filename 1
}
}
}
@@ -726,6 +772,11 @@ namespace eval X {
if {$project_menu_locked} {return}
+ # Won't save read-only file
+ if {[$actualProject editor_procedure {} cget {-ro_mode}]} {
+ return
+ }
+
# This function is critical
if {$critical_procedure_in_progress} {return}
set critical_procedure_in_progress 1
@@ -747,17 +798,17 @@ namespace eval X {
-initialfile [lindex $filename 1] \
-title [mc "Save file - MCU 8051 IDE"] \
-directory $directory \
- -defaultmask $defaultmask -multiple 0 -filetypes {
- {{Assembly language} {*.asm} }
- {{C source} {*.c} }
- {{C header} {*.h} }
- {{All files} {*} }
- }
+ -defaultmask $defaultmask -multiple 0 -filetypes [list \
+ [list [mc "Assembly language"] {*.asm}] \
+ [list [mc "C source"] {*.c}] \
+ [list [mc "C header"] {*.h}] \
+ [list [mc "All files"] {*}] \
+ ]
# Save file after press of OK button
fsd setokcmd {
set filename [X::fsd get]
- ${X::actualProject} save_as $filename
+ ${::X::actualProject} save_as $filename
}
# activate the dialog
@@ -779,7 +830,7 @@ namespace eval X {
if {$critical_procedure_in_progress} {return}
set critical_procedure_in_progress 1
- # Save all opended files
+ # Save all opened files
$actualProject editor_save_all
set critical_procedure_in_progress 0
@@ -805,7 +856,7 @@ namespace eval X {
set critical_procedure_in_progress 0
}
- ## Close all opended files
+ ## Close all opened files
# @return void
proc __close_all {} {
variable actualProject ;# Object: Current project
@@ -934,7 +985,7 @@ namespace eval X {
# @return void
proc __find {} {
variable actualProject ;# Object: Current project
- variable find_String ;# Search string
+ variable find_String {} ;# Search string
variable find_option_CS ;# Bool: Case sensitive
variable find_option_back ;# Bool: Search backwards (checkbox)
variable find_option_cur ;# Book: Search from cursor
@@ -956,7 +1007,7 @@ namespace eval X {
}
# Create a new toplevel window for the dialog
- set win [toplevel .find -class {Find dialog} -bg {#EEEEEE}]
+ set win [toplevel .find -class {Find dialog} -bg ${::COMMON_BG_COLOR}]
# String to search for
label $win.findLabel -compound left -image ::ICONS::16::find -text [mc "Text to find:"]
@@ -982,7 +1033,7 @@ namespace eval X {
# Determinate wheather there is some selected text
if {[$actualProject editor_procedure {} getselection {}] == {}} {
set find_allow_selection 0
- } {
+ } else {
set find_allow_selection 1
}
@@ -992,18 +1043,18 @@ namespace eval X {
foreach opt { CS back cur sel reg } \
txt { "Case sensitive" "Backwards" "From cursor" "Selected text" "Regular expr." } \
helptext {
- {Case sensitive search}
- {Search backwards from the specified location}
- {Start search from cursor instead of begining}
- {Search within selected text only}
- {Use search string as regular expression}
+ "Case sensitive search"
+ "Search backwards from the specified location"
+ "Start search from cursor instead of beginning"
+ "Search within selected text only"
+ "Use search string as regular expression"
} \
{
# Disable/Enable "in selection" checkbox
if {$opt == {sel} && !$find_allow_selection} {
set state disabled
set X::find_option_sel 0
- } {
+ } else {
set state normal
}
@@ -1013,7 +1064,7 @@ namespace eval X {
-variable X::find_option_$opt \
-state $state \
] -column $col -row $row -sticky wns
- DynamicHelp::add $optionsFrame.option_$opt -text $helptext
+ DynamicHelp::add $optionsFrame.option_$opt -text [mc $helptext]
incr col
if {$col == 2} {
@@ -1084,7 +1135,7 @@ namespace eval X {
variable find_option_cur ;# Book: Search from cursor
variable find_option_sel ;# Bool: Search only in the seleted text
variable find_option_reg ;# Bool: Consider search string to be a regular expression
- variable find_retry_search ;# Bool: Search restarted from begining/end
+ variable find_retry_search ;# Bool: Search restarted from beginning/end
variable find_back_dir ;# Bool: Search backwards (real option)
variable find_history ;# List of the last 10 search strings
@@ -1113,7 +1164,7 @@ namespace eval X {
set find_option_notCS [expr {!$find_option_CS}]
if {!$find_allow_selection} {
set option_sel 0
- } {
+ } else {
set option_sel $find_option_sel
}
@@ -1147,10 +1198,10 @@ namespace eval X {
}
## Retry search -- auxiliary procedure for '__find'
- # Useful when search cursor reach begining/end of the document
+ # Useful when search cursor reach beginning/end of the document
# @return Bool result
proc retry_search {} {
- variable find_retry_search ;# Bool: Search restarted from begining/end
+ variable find_retry_search ;# Bool: Search restarted from beginning/end
variable find_String ;# Search string
variable find_option_back ;# Bool: Search backwards (checkbox)
variable find_option_cur ;# Book: Search from cursor
@@ -1178,29 +1229,29 @@ namespace eval X {
# Backward search
if {$find_back_dir} {
if {[tk_messageBox \
- -icon question \
- -type yesno \
- -parent . \
- -title [mc "Find - %s" ${::APPNAME}] \
- -message [mc "Begining of document reached\n\nContinue from end ?"] \
- ]} {
- set find_next_prev_in_P 0
- set find_backward_index end
- set find_forward_index 1.0
- set find_option_cur 0
- # Retry search
- find_next_prev [expr {!$find_option_back}]
+ -icon question \
+ -type yesno \
+ -parent . \
+ -title [mc "Find - %s" ${::APPNAME}] \
+ -message [mc "Beginning of document reached\n\nContinue from end ?"] \
+ ] == {yes}} then {
+ set find_next_prev_in_P 0
+ set find_backward_index end
+ set find_forward_index 1.0
+ set find_option_cur 0
+ # Retry search
+ find_next_prev [expr {!$find_option_back}]
}
# Forward search
- } {
+ } else {
if {[tk_messageBox \
-icon question \
-type yesno \
-parent . \
-title [mc "Find - %s" ${::APPNAME}] \
- -message [mc "End of document reached\n\nContinue from begining ?"] \
- ]} {
+ -message [mc "End of document reached\n\nContinue from beginning ?"] \
+ ] == {yes}} then {
set find_next_prev_in_P 0
set find_backward_index end
set find_forward_index 1.0
@@ -1215,7 +1266,7 @@ namespace eval X {
set find_retry_search 0
}
- ## Find next occurence of the search string
+ ## Find next occurrence of the search string
# @return void
proc __find_next {} {
variable critical_procedure_in_progress ;# Bool: Disables procedures which takes a long time
@@ -1228,7 +1279,7 @@ namespace eval X {
find_next_prev 0
}
- ## Find previous occurence of the search string
+ ## Find previous occurrence of the search string
# @return void
proc __find_prev {} {
variable critical_procedure_in_progress ;# Bool: Disables procedures which takes a long time
@@ -1241,7 +1292,7 @@ namespace eval X {
find_next_prev 1
}
- ## Find next/previous occurence of the search string
+ ## Find next/previous occurrence of the search string
# @parm Bool back_dir - Search backwards
# @return void
proc find_next_prev {back_dir} {
@@ -1254,11 +1305,11 @@ namespace eval X {
variable find_option_cur ;# Book: Search from cursor
variable find_option_sel ;# Bool: Search only in the seleted text
variable find_option_reg ;# Bool: Consider search string to be a regular expression
- variable find_retry_search ;# Bool: Search restarted from begining/end
+ variable find_retry_search ;# Bool: Search restarted from beginning/end
variable find_back_dir ;# Bool: Search backwards (real option)
variable find_next_prev_in_P ;# Bool: Procedure 'find_next_prev' in progress
- # This function is not avaliable for exeternal embedded editors
+ # This function is not available for exeternal embedded editors
if {${::Editor::editor_to_use}} {return}
# This function cannot run multithreaded
@@ -1282,16 +1333,16 @@ namespace eval X {
if {[$editor compare $find_forward_index == insert]} {
$editor mark set insert $find_backward_index
}
- } {
+ } else {
if {[$editor compare $find_backward_index == insert]} {
$editor mark set insert $find_forward_index
}
}
set index insert
- } {
+ } else {
if {$find_back_dir} {
set index $find_backward_index
- } {
+ } else {
set index $find_forward_index
}
}
@@ -1318,8 +1369,8 @@ namespace eval X {
# @return void
proc __replace {} {
variable actualProject ;# Object: Current project
- variable replace_String ;# String to replace
- variable replace_Replacement ;# Replacement for the search string
+ variable replace_String {} ;# String to replace
+ variable replace_Replacement {} ;# Replacement for the search string
variable replace_option_CS ;# Bool: Case sensitive
variable replace_option_back ;# Bool: Search backwards (checkbox)
variable replace_option_cur ;# Book: Search from cursor
@@ -1342,7 +1393,7 @@ namespace eval X {
}
# Create a new toplevel window for the dialog
- set win [toplevel .replace -class {Replace dialog} -bg {#EEEEEE}]
+ set win [toplevel .replace -class {Replace dialog} -bg ${::COMMON_BG_COLOR}]
# Create labelframe "String to find"
label $win.findLabel -compound left -image ::ICONS::16::find -text [mc "Text to find: "]
@@ -1373,7 +1424,7 @@ namespace eval X {
DynamicHelp::add $replaceFrame.entry -text [mc "Replacement for search string"]
# Create and pack options checkboxes labelframe
- label $win.optionsLabel -compound left -image ::ICONS::16::configure -text "Options"
+ label $win.optionsLabel -compound left -image ::ICONS::16::configure -text [mc "Options"]
set optionsFrame [ttk::labelframe $win.optionsFrame \
-labelwidget $win.optionsLabel \
]
@@ -1385,19 +1436,20 @@ namespace eval X {
foreach opt { CS back cur reg prompt} \
txt { "Case sensitive" "Backwards" "From cursor" "Regular expr." "Prompt on replace"} \
helptext {
- {Case sensitive search}
- {Search backwards from the specified location}
- {Start search from cursor instead of begining}
- {Use search string as regular expression}
- {Prompt on replace}
- } {
+ "Case sensitive search"
+ "Search backwards from the specified location"
+ "Start search from cursor instead of beginning"
+ "Use search string as regular expression"
+ "Prompt on replace"
+ } \
+ {
# Create checkbutton
grid [checkbutton $optionsFrame.option_$opt \
-text [mc $txt] \
-variable X::replace_option_$opt \
] -column $col -row $row -sticky wns
- DynamicHelp::add $optionsFrame.option_$opt -text $helptext
+ DynamicHelp::add $optionsFrame.option_$opt -text [mc $helptext]
incr col
if {$col == 2} {
@@ -1413,13 +1465,13 @@ namespace eval X {
-compound left \
-image ::ICONS::16::ok \
-command {X::replace_REPLACE} \
- ] -side left
+ ] -side left -padx 2
pack [ttk::button $buttonFrame.cancel \
-text [mc "Cancel"] \
-compound left \
-image ::ICONS::16::button_cancel \
-command {X::replace_CANCEL} \
- ] -side left
+ ] -side left -padx 2
pack $buttonFrame -pady 5
# Events binding (Enter == Replace; Escape == Cancel)
@@ -1492,36 +1544,36 @@ namespace eval X {
$replace_option_reg $replace_option_notCS \
$replace_String $replace_Replacement \
$replace_option_prompt X::replace_prompt]
- ]} {
- if {!$replace_option_cur} {return}
+ ]} then {
+ if {!$replace_option_cur} {return}
- set replace_option_cur_tmp $replace_option_cur
- set replace_option_cur 0
+ set replace_option_cur_tmp $replace_option_cur
+ set replace_option_cur 0
- # Retry search
- if {$replace_option_back} {
- if {[tk_messageBox \
- -icon question \
- -type yesno \
- -parent . \
- -title [mc "Replace - %s" ${::APPNAME}] \
- -message [mc "Begining of document reached\n\nContinue from end ?"] \
- ]} {
- replace_REPLACE
- }
- } {
- if {[tk_messageBox \
- -icon question \
- -type yesno \
- -parent . \
- -title [mc "Replace - %s" ${::APPNAME}] \
- -message [mc "End of document reached\n\nContinue from begining ?"] \
- ]} {
- replace_REPLACE
- }
+ # Retry search
+ if {$replace_option_back} {
+ if {[tk_messageBox \
+ -icon question \
+ -type yesno \
+ -parent . \
+ -title [mc "Replace - %s" ${::APPNAME}] \
+ -message [mc "Beginning of document reached\n\nContinue from end ?"] \
+ ]} then {
+ replace_REPLACE
}
+ } else {
+ if {[tk_messageBox \
+ -icon question \
+ -type yesno \
+ -parent . \
+ -title [mc "Replace - %s" ${::APPNAME}] \
+ -message [mc "End of document reached\n\nContinue from beginning ?"] \
+ ]} then {
+ replace_REPLACE
+ }
+ }
- set replace_option_cur $replace_option_cur_tmp
+ set replace_option_cur $replace_option_cur_tmp
}
}
@@ -1543,11 +1595,11 @@ namespace eval X {
if {$replace_prompt_opened} {
replace_prompt_DESTROY
# Open the dialog
- } {
+ } else {
set replace_prompt_opened 1
# Create dialog window and restore previous geometry
- toplevel .replace_prompt -class {Replace prompt dialog} -bg {#EEEEEE}
+ toplevel .replace_prompt -class {Replace prompt dialog} -bg ${::COMMON_BG_COLOR}
if {[info exists replace_prompt_geometry]} {
wm geometry .replace_prompt $replace_prompt_geometry
}
@@ -1558,7 +1610,7 @@ namespace eval X {
-image ::ICONS::32::help \
] -side left -padx 10
pack [label .replace_prompt.topFrame.label \
- -text [mc "Found an occurence of your search term.\nWhat do you want to do ?"] \
+ -text [mc "Found an occurrence of your search term.\nWhat do you want to do ?"] \
] -fill both -expand 1 -side right
# Create separator
@@ -1685,7 +1737,7 @@ namespace eval X {
# Create dialog window
set goto_opened 1
- set win [toplevel .goto -class {Goto dialog} -bg {#EEEEEE}]
+ set win [toplevel .goto -class {Go to dialog} -bg ${::COMMON_BG_COLOR}]
# Create window label frame
label $win.header -text [mc "Go to line"] -image ::ICONS::16::goto -compound left
@@ -1706,13 +1758,12 @@ namespace eval X {
-text [mc "Graphical representation of line where to go"]
# Create spinbox widget
- pack [spinbox $topFrame.spinbox \
+ pack [ttk::spinbox $topFrame.spinbox \
-from 1 -to $editor_lines \
- -textvariable X::goto \
+ -textvariable ::X::goto \
-validate key \
- -validatecommand {X::goto_validate %P} \
+ -validatecommand {::X::goto_validate %P}\
-width 6 \
- -command "$topFrame.spinbox selection range 0 end" \
] -side left
DynamicHelp::add $topFrame.spinbox -text [mc "Line where to go"]
@@ -1723,14 +1774,14 @@ namespace eval X {
-compound left \
-image ::ICONS::16::ok \
-command {X::goto_OK} \
- ] -side left
+ ] -side left -padx 2
pack [ttk::button $buttonFrame.cancel \
-text [mc "Cancel"] \
-compound left \
-image ::ICONS::16::button_cancel \
-command {X::goto_CANCEL} \
- ] -side left
- pack $buttonFrame -pady 5
+ ] -side left -padx 2
+ pack $buttonFrame -pady 5 -padx 5
# Events binding (Enter == Ok, Esc == CANCEL)
bind $win <KeyRelease-Return> {X::goto_OK; break}
@@ -1743,7 +1794,7 @@ namespace eval X {
# Nessesary window manager options -- modal window
wm iconphoto $win ::ICONS::16::goto
- wm title $win [mc "Goto line - MCU 8051 IDE"]
+ wm title $win [mc "Go to line - MCU 8051 IDE"]
wm minsize $win 200 100
wm protocol $win WM_DELETE_WINDOW {
X::goto_CANCEL
@@ -1762,7 +1813,7 @@ namespace eval X {
if {$value > $editor_lines} {
return 0
- } {
+ } else {
return 1
}
}
@@ -1843,7 +1894,7 @@ namespace eval X {
# Determinate initial directory
if {$project_menu_locked} {
set directory {~}
- } {
+ } else {
set directory [$actualProject cget -projectPath]
}
@@ -1867,10 +1918,10 @@ namespace eval X {
## Invoke dialog "New Project"
# @return void
proc __proj_new {} {
- variable avaliable_processors ;# List of supported processors
+ variable available_processors ;# List of supported processors
variable actualProject ;# Object: Current project
- variable project_new_name ;# Name of the new project
- variable project_new_dir ;# Directory of the new project
+ variable project_new_name {} ;# Name of the new project
+ variable project_new_dir {} ;# Directory of the new project
variable critical_procedure_in_progress ;# Bool: Disables procedures which takes a long time
variable project_new_processor {AT89S52};# Processor type (e.g. "AT89C2051")
variable project_new_xdata_ena 0 ;# Bool: XDATA memory connected
@@ -1888,7 +1939,7 @@ namespace eval X {
if {$critical_procedure_in_progress} {return}
# Create dialog window
- set win [toplevel .project_new -class {New project} -bg {#EEEEEE}]
+ set win [toplevel .project_new -class {New project} -bg ${::COMMON_BG_COLOR}]
# Create window header (text and some icon)
set header [frame $win.header]
@@ -1946,14 +1997,14 @@ namespace eval X {
set proc_frame_top [frame $proc_frame.top]
set proc_frame_middle [frame $proc_frame.middle]
set proc_frame_middle_left [ttk::labelframe $proc_frame_middle.middle \
- -padding 5 -text [mc "XDATA"]]
+ -padding 5 -text [mc "External RAM (XDATA)"]]
set proc_frame_middle_right [ttk::labelframe $proc_frame_middle.right \
- -padding 5 -text [mc "XCODE"]]
+ -padding 5 -text [mc "External ROM/FLASH (XCODE)"]]
# Create components of top frame (Type: <ComboBox> <Button>)
pack [label $proc_frame_top.lbl -text [mc "Type:"]] -side left
pack [ttk::combobox $proc_frame_top.combo \
- -values $avaliable_processors \
+ -values $available_processors \
-state readonly \
-textvariable ::X::project_new_processor \
] -side left -fill x -fill x
@@ -1981,7 +2032,7 @@ namespace eval X {
set project_new_xd_scl [ttk::scale $proc_frame_left_btm.scale \
-orient horizontal \
-variable ::X::project_new_xdata \
- -from 0 -to 0xFFFF \
+ -from 0 -to 0x10000 \
-command "
set ::X::project_new_xdata \[expr {int(\${::X::project_new_xdata})}\]
$proc_frame_left_btm.spinbox selection range 0 end
@@ -1990,12 +2041,11 @@ namespace eval X {
DynamicHelp::add $project_new_xd_scl \
-text [mc "Amount of external data memory"]
pack $project_new_xd_scl -fill x -side left -expand 1 -padx 2
- set project_new_xd_spb [spinbox $proc_frame_left_btm.spinbox \
- -textvariable ::X::project_new_xdata \
- -width 5 -from 0 -to 0xFFFF \
- -bg white -validate all \
- -vcmd {::SelectMCU::validate_xdata %P} \
- -command "$proc_frame_left_btm.spinbox selection range 0 end ;#" \
+ set project_new_xd_spb [ttk::spinbox $proc_frame_left_btm.spinbox \
+ -textvariable ::X::project_new_xdata \
+ -width 5 -from 0 -to 0x10000 \
+ -validate all \
+ -validatecommand {::SelectMCU::validate_xdata %P} \
]
DynamicHelp::add $project_new_xd_spb \
-text [mc "Amount of external data memory"]
@@ -2015,7 +2065,7 @@ namespace eval X {
set project_new_xc_scl [ttk::scale $proc_frame_right_btm.scale \
-orient horizontal \
-variable ::X::project_new_xcode \
- -from 0 -to 0xFFFF \
+ -from 0 -to 0x10000 \
-command "
set ::X::project_new_xcode \[expr {int(\${::X::project_new_xcode})}\]
$proc_frame_right_btm.spinbox selection range 0 end
@@ -2024,12 +2074,11 @@ namespace eval X {
DynamicHelp::add $project_new_xc_scl \
-text [mc "Amount of total program memory minus internal program memory"]
pack $project_new_xc_scl -fill x -side left -expand 1 -padx 2
- set project_new_xc_spb [spinbox $proc_frame_right_btm.spinbox \
- -textvariable ::X::project_new_xcode \
- -width 5 -from 0 -to 0xFFFF \
- -bg white -validate all \
- -vcmd {::X::proj_new_validate_xcode %P} \
- -command "$proc_frame_right_btm.spinbox selection range 0 end ;#" \
+ set project_new_xc_spb [ttk::spinbox $proc_frame_right_btm.spinbox \
+ -textvariable ::X::project_new_xcode \
+ -width 5 -from 0 -to 0x10000 \
+ -validate all \
+ -validatecommand {::X::proj_new_validate_xcode %P} \
]
DynamicHelp::add $project_new_xc_spb \
-text [mc "Amount of total program memory minus internal program memory"]
@@ -2049,15 +2098,17 @@ namespace eval X {
-compound left \
-image ::ICONS::16::ok \
-command {X::project_new_OK} \
- ] -side left -padx 5
+ ] -side left -padx 2
pack [ttk::button $buttonFrame.cancel \
-text [mc "Cancel"] \
-compound left \
-image ::ICONS::16::button_cancel \
-command {X::project_new_CANCEL} \
- ] -side left -padx 5
+ ] -side left -padx 2
pack $buttonFrame -pady 5
+ focus -force $name.entry
+
# Adjust XDATA & XCODE controls
proj_new_mcu_changed
@@ -2082,7 +2133,7 @@ namespace eval X {
## Binding for processor type combobox -modifycmd
# Usage: ComboBox -modifycmd ::X::proj_new_mcu_changed
# This function gets informations about selected processor
- # and adjusts XCODE & XDATA memory constrols.
+ # and adjusts XCODE & XDATA memory controls.
# @return void
proc proj_new_mcu_changed {} {
variable project_new_processor ;# Processor type (e.g. "8051")
@@ -2097,7 +2148,7 @@ namespace eval X {
# Get processor details
set details [::SelectMCU::get_processor_details $project_new_processor]
if {$details == {}} {
- puts stderr "Unknown error occured in ::X::proj_new_mcu_changed !\nPlease check your installation."
+ puts stderr "Unknown error occurred in ::X::proj_new_mcu_changed !\nPlease check your installation."
return
}
@@ -2105,7 +2156,7 @@ namespace eval X {
if {[lindex $details 0] != {yes}} {
set project_new_xdata_ena 0
$project_new_xd_chb configure -state disabled
- } {
+ } else {
$project_new_xd_chb configure -state normal
}
@@ -2113,12 +2164,12 @@ namespace eval X {
if {[lindex $details 1] != {yes}} {
set project_new_xcode_ena 0
$project_new_xc_chb configure -state disabled
- } {
+ } else {
$project_new_xc_chb configure -state normal
}
# Adjust XCODE memory scale & spinbox maximum value
- set project_new_max_xcode [expr {0xFFFF - ([lindex $details 2] * 1024)}]
+ set project_new_max_xcode [expr {0x10000 - ([lindex $details 2] * 1024)}]
$project_new_xc_scl configure -to $project_new_max_xcode
$project_new_xc_spb configure -to $project_new_max_xcode
@@ -2127,7 +2178,7 @@ namespace eval X {
proj_new_xcode_disena
}
- ## Enable/Disable XDATA scale & spinbox acording to $project_new_xdata_ena
+ ## Enable/Disable XDATA scale & spinbox according to $project_new_xdata_ena
# @return void
proc proj_new_xdata_disena {} {
variable project_new_xd_scl ;# Widget: XDATA scale
@@ -2139,13 +2190,13 @@ namespace eval X {
$project_new_xd_scl state !disabled
$project_new_xd_spb configure -state normal
# Disable
- } {
+ } else {
$project_new_xd_scl state disabled
$project_new_xd_spb configure -state disabled
}
}
- ## Enable/Disable XCODE scale & spinbox acording to $project_new_xcode_ena
+ ## Enable/Disable XCODE scale & spinbox according to $project_new_xcode_ena
# @return void
proc proj_new_xcode_disena {} {
variable project_new_xc_scl ;# Widget: XCODE scale
@@ -2155,12 +2206,10 @@ namespace eval X {
# Enable
if {$project_new_xcode_ena} {
$project_new_xc_scl state !disabled
-# $project_new_xc_scl configure -troughcolor {#FFFFFF}
$project_new_xc_spb configure -state normal
# Disable
- } {
+ } else {
$project_new_xc_scl state disabled
-# $project_new_xc_scl configure -troughcolor {#AAAAAA}
$project_new_xc_spb configure -state disabled
}
}
@@ -2195,13 +2244,13 @@ namespace eval X {
# Determinate initial XDATA memory for the dialog
if {$project_new_xdata_ena} {
set xdata $project_new_xdata
- } {
+ } else {
set xdata 0
}
# Determinate initial XCODE memory for the dialog
if {$project_new_xcode_ena} {
set xcode $project_new_xcode
- } {
+ } else {
set xcode 0
}
@@ -2214,20 +2263,21 @@ namespace eval X {
# Process results
set project_new_processor [lindex $result 0]
set project_new_xdata [lindex $result 1]
- set project_new_xcoda [lindex $result 2]
- proj_new_mcu_changed
+ set project_new_xcode [lindex $result 2]
# Adjust XCODE & XDATA checkbuttons
if {$project_new_xdata} {
set project_new_xdata_ena 1
- } {
+ } else {
set project_new_xdata_ena 0
}
if {$project_new_xcode} {
set project_new_xcode_ena 1
- } {
+ } else {
set project_new_xcode_ena 0
}
+
+ proj_new_mcu_changed
}
## Cancel dialog "Create new project" -- auxiliary procedure for '__proj_new'
@@ -2264,7 +2314,7 @@ namespace eval X {
tk_messageBox \
-icon warning \
-type ok \
- -title [mc "Ivalid request"] \
+ -title [mc "Invalid request"] \
-message [mc "Both entries in section general must be filled."] \
-parent .project_new
set critical_procedure_in_progress 0
@@ -2301,20 +2351,20 @@ namespace eval X {
set critical_procedure_in_progress 0
return 0
}
- } {
+ } else {
# Check if this the project does not already exist
if {[file exists "$project_new_dir/$project_new_name.mcu8051ide"]} {
# Ask for owerwrite
if {
- ![tk_messageBox \
+ [tk_messageBox \
-icon question \
-type yesno \
-default no \
-parent .project_new \
-title [mc "File already exists - MCU 8051 IDE"] \
-message [mc "Some project with the same name already exists in the specified directory. \nDo you want to overwrite it ?"] \
- ]
- } {
+ ] != {yes}
+ } then {
# (No) -> Cancel
set critical_procedure_in_progress 0
return 0
@@ -2341,6 +2391,33 @@ namespace eval X {
}
set project_new_xdata [expr {int($project_new_xdata)}]
set project_new_xcode [expr {int($project_new_xcode)}]
+
+ ## Format of this list is: {
+ #+ {version date creator_ver} # tag: tk_mcuide_project
+ #+ {authors copyright license} # tag: authors copyright license
+ #+ {type clock xdata xcode} # tag: processor
+ #+ {watches_file scheme main_file auto_sw_enabled} # tag: options
+ #+ {grid_mode magnification drawing_on
+ #+ mark_flags_true_state mark_flags_latched
+ #+ mark_flags_output active_page} # tag: graph
+ #+ {description todo} # tag: descriptin todo
+ #+ {radix angle_unit # tag: calculator
+ #+ display0 display1 display2
+ #+ memory0 memory1 memory2
+ #+ frequency time mode}
+ #+ {other_options} # tag: other_options
+ #+ {compiler_options}
+ #+ {files_count {current_file # tag: files
+ #+ current_file2 pwin_sash pwin_orient}
+ #+ { # tag: file actual_line md5_hash path bookmarks breakpoints
+ #+ name active o_bookmark p_bookmark
+ #+ file_index read_only actual_line md5_hash
+ #+ path bookmarks breakpoints eol
+ #+ enc highlight notes
+ #+ }
+ #+ ...
+ #+ }
+ #+ }
set project_data [list \
[list {} [clock format [clock seconds] -format {%D}] {}]\
[list [file tail [file normalize ~]] {} {}] \
@@ -2360,18 +2437,18 @@ namespace eval X {
[list $calc_radix $calc_angle {} {} {} {} {} {}] \
{} {} \
[list 0 [list {} {} 0 {}]] \
- ]
+ ]
# Create a new project file
if {[catch {
- set prj_file [open "$project_new_dir/$project_new_name.mcu8051ide" w 420]
+ set prj_file [open "$project_new_dir/$project_new_name.mcu8051ide" w 0640]
}]} then {
# Failed
tk_messageBox \
-parent . \
-type ok \
-icon error \
- -message [mc "Unable to write to file:\n\"%s\"" $project_new_dir/$project_new_name.mcu8051ide]
+ -message [mc "Unable to write to file:\n\"%s\"" "$project_new_dir/$project_new_name.mcu8051ide"]
set critical_procedure_in_progress 0
return
}
@@ -2385,12 +2462,13 @@ namespace eval X {
set projectDescriptor [regsub -all -- {\s} $project_new_name {-}]
regsub -all {[\\\/\.\,`\!@#\$%\^&:\;\|\*\"\(\)\[\]\{\}]} $projectDescriptor \
{_} projectDescriptor
+ set projectDescriptor "project_${projectDescriptor}"
if {[lsearch -exact -ascii ${X::openedProjects} $projectDescriptor] != -1} {
append project_new_name {(0)}
append projectDescriptor {_0}
- while 1 {
+ while {1} {
if {[lsearch -exact -ascii ${X::openedProjects} $projectDescriptor] == -1} {break}
regexp {\d+$} $projectDescriptor index
@@ -2425,11 +2503,14 @@ namespace eval X {
}
disaena_menu_toolbar_for_current_project
+ # set MCU name in status bar, kdb
+ .statusbarMCU configure -text $project_new_processor
+
set critical_procedure_in_progress 0
}
## Disable menu items and functions functions which are
- # avaliable only if there is at least one opened project
+ # available only if there is at least one opened project
# @return void
proc Lock_project_menu {} {
variable project_menu_locked ;# Bool: Indicates than there is at least one opened project
@@ -2446,7 +2527,7 @@ namespace eval X {
adjust_mm_and_tb_ext_editor
}
- ## Enable menu items and functions functions which are avaliable only if there
+ ## Enable menu items and functions functions which are available only if there
# is at least one opened project and create NoteBook for project tabs
# @return void
proc Unlock_project_menu {} {
@@ -2510,10 +2591,10 @@ namespace eval X {
KIFSD::FSD fsd \
-title [mc "Open project - MCU 8051 IDE"] \
-directory $defaultDirectory \
- -defaultmask 0 -multiple 0 -filetypes {
- {{MCU 8051 IDE project} {*.mcu8051ide} }
- {{All files} {*} }
- }
+ -defaultmask 0 -multiple 0 -filetypes [list \
+ [list [mc "MCU 8051 IDE project"] {*.mcu8051ide} ] \
+ [list [mc "All files"] {*} ] \
+ ]
# Open the selected after press of OK button
fsd setokcmd {
@@ -2526,7 +2607,7 @@ namespace eval X {
-parent . \
-title [mc "Error - MCU 8051 IDE"] \
-message [mc "Unable to load file: %s" $filename]
- } {
+ } else {
${::X::actualProject} editor_procedure {} highlight_visible_area {}
::X::recent_files_add 0 $filename
}
@@ -2540,7 +2621,7 @@ namespace eval X {
}
## Retrieve project related data from object of the current project
- # @parm Bool all_info - All data (include todo list and such)
+ # @parm Bool all_info - All data (include to do list and such)
# @return void
proc Project_retrieve_data_from_application {all_info} {
variable actualProject ;# Object: Current project
@@ -2552,7 +2633,7 @@ namespace eval X {
variable project_edit_version ;# Project version
variable project_edit_date ;# Project date (last update)
variable project_edit_copyright ;# Copyright information
- variable project_edit_licence ;# Licence information
+ variable project_edit_license ;# License information
variable project_edit_authors ;# Project authors
variable project_edit_description ;# Project description
variable project_edit_main_file ;# Project main file
@@ -2572,7 +2653,7 @@ namespace eval X {
set project_edit_date [ $actualProject cget -P_information_date ]
set project_edit_authors [ $actualProject cget -G_information_authors ]
set project_edit_copyright [ $actualProject cget -G_information_copyright ]
- set project_edit_licence [ $actualProject cget -G_information_licence ]
+ set project_edit_license [ $actualProject cget -G_information_license ]
set project_edit_clock [ $actualProject cget -P_option_clock ]
set project_edit_description [ $actualProject cget -project_description ]
set project_new_processor [ $actualProject cget -P_option_mcu_type ]
@@ -2621,7 +2702,7 @@ namespace eval X {
variable project_edit_version ;# Project version
variable project_edit_date ;# Project date (last update)
variable project_edit_copyright ;# Copyright information
- variable project_edit_licence ;# Licence information
+ variable project_edit_license ;# License information
variable project_edit_authors ;# Project authors
variable project_edit_description ;# Project description
variable project_edit_clock ;# Default clock rate
@@ -2644,6 +2725,12 @@ namespace eval X {
if {$project_menu_locked} {return}
+ # Do not attempt to save a project with read only flag set
+ if {[$actualProject cget -S_flag_read_only]} {
+ puts "Read-only project, saving aborted."
+ return
+ }
+
# This is critical procedure
if {$critical_procedure_in_progress} {return}
set critical_procedure_in_progress 1
@@ -2668,7 +2755,7 @@ namespace eval X {
[list \
$project_edit_authors \
[Project::escape_curlies $project_edit_copyright] \
- [Project::escape_curlies $project_edit_licence]] \
+ [Project::escape_curlies $project_edit_license]] \
[list \
$project_new_processor \
$project_edit_clock \
@@ -2702,9 +2789,10 @@ namespace eval X {
# Save project definition file
if {[catch {
- set prj_file [open $filename w 420]
+ set prj_file [open $filename w 0640]
}]} then {
tk_messageBox \
+ -parent . \
-type ok \
-icon error \
-title [mc "IO Error"] \
@@ -2721,15 +2809,16 @@ namespace eval X {
}
## Invoke dialog "Edit project"
+ # @parm Bool choose_MCU_now=0 - Invoke MCU selection dialog right away and inore other config options ...
# @return void
- proc __proj_edit {} {
+ proc __proj_edit {{choose_MCU_now 0}} {
variable actualProject ;# Object: Current project
- variable avaliable_processors ;# List of supported processors
+ variable available_processors ;# List of supported processors
variable project_edit_version ;# Project version
variable project_edit_date ;# Project date (last update)
variable project_edit_copyright ;# Copyright information
- variable project_edit_licence ;# Licence information
+ variable project_edit_license ;# License information
variable project_edit_authors ;# Project authors
variable project_edit_description ;# Project description
variable project_edit_clock ;# Default clock rate
@@ -2760,7 +2849,7 @@ namespace eval X {
Project_retrieve_data_from_application 0
# Create dialog window
- set win [toplevel .project_edit -class {Edit project} -bg {#EEEEEE}]
+ set win [toplevel .project_edit -class {Edit project} -bg ${::COMMON_BG_COLOR}]
# Create main frames (top.left; top.right; bottom)
set top_frame [frame $win.top]
@@ -2768,7 +2857,7 @@ namespace eval X {
set top_left_frame [frame $top_frame.left]
set top_right_frame [frame $top_frame.right]
- ## GENERAL INFORMATION (version, date, authors, copyright, licence)
+ ## GENERAL INFORMATION (version, date, authors, copyright, license)
label $win.lb_general_info_label \
-compound left \
-text [mc "General information"] \
@@ -2826,24 +2915,24 @@ namespace eval X {
] -row 3 -column 2 -sticky we -columnspan 2
DynamicHelp::add $bframe.copyright_entry -text [mc "Copyright information"]
- # licence
- grid [Label $bframe.licence_label \
- -text [mc "Licence"] \
- -helptext [mc "Name of the licence"] \
+ # license
+ grid [Label $bframe.license_label \
+ -text [mc "License"] \
+ -helptext [mc "Name of the license"] \
] -row 4 -column 1 -sticky w
- grid [ttk::entry $bframe.licence_entry \
- -textvariable X::project_edit_licence \
+ grid [ttk::entry $bframe.license_entry \
+ -textvariable X::project_edit_license \
-validate key \
-validatecommand {::X::project_edit_validate %P} \
] -row 4 -column 2 -sticky we -columnspan 2
- DynamicHelp::add $bframe.licence_entry -text [mc "Name of the licence"]
+ DynamicHelp::add $bframe.license_entry -text [mc "Name of the license"]
# authors
set tframe [frame .project_edit.top.left.lb_general_info.tframe]
pack $tframe -fill both -expand 1 -padx 5
- pack [Label $tframe.label \
- -text [mc "Authors:"] \
- -helptext {List of project authors (one per line)} \
+ pack [Label $tframe.label \
+ -text [mc "Authors:"] \
+ -helptext [mc "List of project authors (one per line)"] \
] -anchor w
pack [frame $tframe.frame] -fill both -expand 1
@@ -2869,9 +2958,9 @@ namespace eval X {
set proc_frame_top1 [frame $lb_compiler.top1]
set proc_frame_middle [frame $lb_compiler.middle]
set proc_frame_middle_left [ttk::labelframe $proc_frame_middle.middle \
- -padding 5 -text [mc "XDATA"]]
+ -padding 5 -text [mc "External RAM (XDATA)"]]
set proc_frame_middle_right [ttk::labelframe $proc_frame_middle.right \
- -padding 5 -text [mc "XCODE"]]
+ -padding 5 -text [mc "External ROM/FLASH (XCODE)"]]
# MCU clock frequency
grid [Label $proc_frame_top1.clock_label \
@@ -2897,7 +2986,10 @@ namespace eval X {
-style Flat.TButton \
-takefocus 0 \
-image ::ICONS::16::locationbar_erase \
- -command {set ::X::project_edit_main_file {}} \
+ -command {
+ set ::X::project_edit_main_file {}
+ ::X::proj_edit_mf_validator {}
+ } \
-state disabled \
]
DynamicHelp::add $proc_frame_top1.clear_but -text [mc "Clear"]
@@ -2908,6 +3000,7 @@ namespace eval X {
-validatecommand {::X::proj_edit_mf_validator %P} \
-textvariable X::project_edit_main_file \
] -row 1 -column 3 -sticky we
+ proj_edit_mf_validator ${::X::project_edit_main_file}
DynamicHelp::add $proc_frame_top1.file_entry \
-text [mc "Project main file (e.g. main.c)\n(empty string means always compile current file)"]
grid [ttk::button $proc_frame_top1.file_select_but \
@@ -2921,7 +3014,7 @@ namespace eval X {
# Create components of top frame (Type: <ComboBox> <Button>)
pack [label $proc_frame_top0.lbl -text [mc "Type:"] -width 14 -anchor w] -side left
pack [ttk::combobox $proc_frame_top0.combo \
- -values $avaliable_processors \
+ -values $available_processors \
-state readonly \
-textvariable ::X::project_new_processor\
] -side left -fill x
@@ -2949,7 +3042,7 @@ namespace eval X {
set project_new_xd_scl [ttk::scale $proc_frame_left_btm.scale \
-orient horizontal \
-variable ::X::project_new_xdata \
- -from 0 -to 0xFFFF \
+ -from 0 -to 0x10000 \
-command "
set ::X::project_new_xdata \[expr {int(\${::X::project_new_xdata})}\]
$proc_frame_left_btm.spinbox selection range 0 end
@@ -2958,23 +3051,23 @@ namespace eval X {
DynamicHelp::add $project_new_xd_scl \
-text [mc "Size of external data memory"]
pack $project_new_xd_scl -fill x -side left -expand 1 -padx 2
- set project_new_xd_spb [spinbox $proc_frame_left_btm.spinbox \
- -textvariable ::X::project_new_xdata \
- -width 5 -from 0 -to 0xFFFF \
- -bg white -validate all \
- -vcmd {::SelectMCU::validate_xdata %P} \
- -command "$proc_frame_left_btm.spinbox selection range 0 end ;#" \
+ set project_new_xd_spb [ttk::spinbox $proc_frame_left_btm.spinbox \
+ -textvariable ::X::project_new_xdata \
+ -width 5 -from 0 -to 0x10000 \
+ -validate all \
+ -validatecommand {::SelectMCU::validate_xdata %P} \
]
DynamicHelp::add $project_new_xd_spb \
-text [mc "Size of external data memory"]
pack $project_new_xd_spb -side right -after $project_new_xd_scl
pack $proc_frame_left_btm -fill both -expand 1
+ proj_new_xdata_disena
# Create components of XCODE labelframe
set project_new_xc_chb [checkbutton $proc_frame_middle_right.checkbutton \
- -variable ::X::project_new_xcode_ena \
- -text [mc "Enable"] \
- -command ::X::proj_new_xcode_disena \
+ -variable ::X::project_new_xcode_ena \
+ -text [mc "Enable"] \
+ -command ::X::proj_new_xcode_disena \
]
pack $project_new_xc_chb -anchor w
DynamicHelp::add $proc_frame_middle_right.checkbutton \
@@ -2983,7 +3076,7 @@ namespace eval X {
set project_new_xc_scl [ttk::scale $proc_frame_right_btm.scale \
-orient horizontal \
-variable ::X::project_new_xcode \
- -from 0 -to 0xFFFF \
+ -from 0 -to 0x10000 \
-command "
set ::X::project_new_xcode \[expr {int(\${::X::project_new_xcode})}\]
$proc_frame_right_btm.spinbox selection range 0 end
@@ -2992,17 +3085,17 @@ namespace eval X {
DynamicHelp::add $project_new_xc_scl \
-text [mc "Amount of total program memory minus internal program memory"]
pack $project_new_xc_scl -fill x -side left -expand 1 -padx 2
- set project_new_xc_spb [spinbox $proc_frame_right_btm.spinbox \
- -textvariable ::X::project_new_xcode \
- -width 5 -from 0 -to 0xFFFF \
- -bg white -validate all \
- -vcmd {::X::proj_new_validate_xcode %P} \
- -command "$proc_frame_right_btm.spinbox selection range 0 end ;#" \
+ set project_new_xc_spb [ttk::spinbox $proc_frame_right_btm.spinbox \
+ -textvariable ::X::project_new_xcode \
+ -width 5 -from 0 -to 0x10000 \
+ -validate all \
+ -validatecommand {::X::proj_new_validate_xcode %P} \
]
DynamicHelp::add $project_new_xc_spb \
-text [mc "Amount of total program memory minus internal program memory"]
pack $project_new_xc_spb -side right -after $project_new_xc_scl
pack $proc_frame_right_btm -fill both -expand 1
+ proj_new_xcode_disena
pack $proc_frame_top0 -anchor w -pady 5 -padx 10
pack $proc_frame_top1 -anchor w -pady 5 -padx 10
@@ -3011,8 +3104,13 @@ namespace eval X {
pack $proc_frame_middle -fill both -expand 1 -pady 5
pack $lb_compiler -fill both -expand 1
- # Adjust XDATA & XCODE controls
+ # Adjust XDATA & XCODE controls - TODO why is this needed here?
+ # editor window has just been created, user hasn't made any selections yet
+ # meaning that mcu has not changed
proj_new_mcu_changed
+ # Martin: Oh yes, now I remeber :) proj_new_mcu_changed has to be called here in order to ensure that the
+ # scale widgets don't offer values out of range. Try to remove the call and then invoke the project
+ # editing dialog and you will see.
## PROJECT DESCRIPTION
label $win.lb_desc_label \
@@ -3064,6 +3162,15 @@ namespace eval X {
X::project_edit_CANCEL
}
wm transient $win .
+
+ if {$choose_MCU_now} {
+ wm withdraw $win
+ proj_new_select_mcu .
+ project_edit_OK
+ return
+ }
+
+ update
catch {grab $win}
raise $win
tkwait window $win
@@ -3077,7 +3184,7 @@ namespace eval X {
variable project_edit_main_file_clr_but ;# Widget: Project main file clear button
if {[string length $string]} {
$project_edit_main_file_clr_but configure -state normal
- } {
+ } else {
$project_edit_main_file_clr_but configure -state disabled
}
return 1
@@ -3097,7 +3204,7 @@ namespace eval X {
set defaultmask 1
} elseif {$ext == {.h}} {
set defaultmask 2
- } {
+ } else {
set defaultmask 3
}
catch {delete object fsd}
@@ -3117,6 +3224,7 @@ namespace eval X {
set ::X::project_edit_main_file \
[string replace $::X::project_edit_main_file \
0 [string length [$::X::actualProject cget -projectPath]]]
+ ::X::proj_edit_mf_validator ${::X::project_edit_main_file}
}
}
fsd activate
@@ -3129,7 +3237,7 @@ namespace eval X {
proc project_edit_validate {string} {
if {[string length $string] > 40} {
return 0
- } {
+ } else {
return 1
}
}
@@ -3148,19 +3256,19 @@ namespace eval X {
# @parm String number - String to validate
# @return Bool - result
proc project_edit_CLOCK_validate {number} {
- if {![regexp {^\d*$} $number]} {return 0}
+ if {![regexp {^\d+(\.\d*)?$} $number]} {return 0}
if {$number > 99999} {return 0}
return 1
}
- ## Cancel dialog "Edit project" -- axiliary procedure for '__proj_edit'
+ ## Cancel dialog "Edit project" -- auxiliary procedure for '__proj_edit'
# @return void
proc project_edit_CANCEL {} {
grab release .project_edit
destroy .project_edit
}
- ## Save project values -- axiliary procedure for '__proj_edit'
+ ## Save project values -- auxiliary procedure for '__proj_edit'
# @return void
proc project_edit_OK {} {
variable actualProject ;# Object: Current project
@@ -3169,7 +3277,7 @@ namespace eval X {
variable project_edit_version ;# Project version
variable project_edit_date ;# Project date (last update)
variable project_edit_copyright ;# Copyright information
- variable project_edit_licence ;# Licence information
+ variable project_edit_license ;# License information
variable project_edit_clock ;# Default clock rate
variable project_edit_main_file ;# Project main file
variable project_new_processor ;# Processor type (e.g. "AT89C2051")
@@ -3178,6 +3286,7 @@ namespace eval X {
variable project_new_xdata ;# Int: Amount of XDATA memory
variable project_new_xcode ;# Int: Amount of XCODE memory
variable project_new_xc_spb ;# Widget: XCODE spinbox
+ variable project_edit_defaults ;# Some default project values
variable projectdetails_last_project {} ;# Project object of the last project details window
@@ -3189,10 +3298,14 @@ namespace eval X {
set project_new_xcode 0
}
+ # Set MCU name in status bar, kdb
+ .statusbarMCU configure -text $project_new_processor
+
# Adjust values
if {$project_edit_clock == {}} {
set project_edit_clock [lindex $project_edit_defaults {1 1}]
}
+ set project_edit_clock [string trimright $project_edit_clock {.}]
set project_new_xdata [expr {int($project_new_xdata)}]
set project_new_xcode [expr {int($project_new_xcode)}]
@@ -3204,15 +3317,16 @@ namespace eval X {
# Change object variables
foreach parm {
P_option_mcu_xdata P_option_mcu_xcode P_information_version
- P_information_date G_information_licence G_information_copyright
+ P_information_date G_information_license G_information_copyright
P_option_clock P_option_mcu_type P_option_main_file
} \
value {
project_new_xdata project_new_xcode project_edit_version
- project_edit_date project_edit_licence project_edit_copyright
+ project_edit_date project_edit_license project_edit_copyright
project_edit_clock project_new_processor project_edit_main_file
- } {
- $actualProject configure -$parm [subst "\$$value"]
+ } \
+ {
+ $actualProject configure -$parm [subst -nocommands "\$$value"]
}
$actualProject Simulator_set_clock $project_edit_clock
$actualProject configure -project_description \
@@ -3220,7 +3334,7 @@ namespace eval X {
$actualProject configure -G_information_authors \
[.project_edit.top.left.lb_general_info.tframe.frame.text get 1.0 end-1c]
- ## Adjust simulator control panel, register watches and hexeditors
+ ## Adjust simulator control panel, register watches and hex editors
# Hex editors
close_hexedit eram $actualProject
close_hexedit eeprom $actualProject
@@ -3232,7 +3346,7 @@ namespace eval X {
if {$xcode_prev != $project_new_xcode} {
close_hexedit code $actualProject
$actualProject simulator_resize_code_memory \
- [expr {$project_new_xcode + 0xFFFF - [$project_new_xc_spb cget -to]}]
+ [expr {$project_new_xcode + 0x10000 - [$project_new_xc_spb cget -to]}]
}
# Simulator control panel and register watches
if {$proc_prev != $project_new_processor} {
@@ -3273,10 +3387,11 @@ namespace eval X {
$actualProject configure -P_option_mcu_type $new_processor
$actualProject configure -procData \
[SelectMCU::get_processor_details $new_processor]
- $actualProject refresh_project_avaliable_SFR
+ $actualProject refresh_project_available_SFR
$actualProject stack_monitor_monitor_close
$actualProject interrupt_monitor_close
+ $actualProject uart_monitor_close
$actualProject simulator_initialize_mcu
$actualProject SimGUI_clean_up
$actualProject simulator_itialize_simulator_control_panel
@@ -3288,6 +3403,8 @@ namespace eval X {
$actualProject rightPanel_watch_disable
$actualProject sfr_watches_commit_new_sfr_set
$actualProject pale_MCU_changed
+ $actualProject stopwatch_clear_all C
+ $actualProject stopwatch_clear_all O
if {$was_enabled} {
__initiate_sim
@@ -3349,7 +3466,7 @@ namespace eval X {
if {$response == {yes}} {
close_project
return 1
- } {
+ } else {
return 0
}
}
@@ -3366,6 +3483,9 @@ namespace eval X {
variable simulator_enabled ;# List of booleans: Simulator engaged
variable critical_procedure_in_progress ;# Bool: Disables procedures which takes a long time
+ # Make sure that there are no help windows visible
+ remove_all_help_windows
+
# This function is critical
if {$critical_procedure_in_progress} {return}
set critical_procedure_in_progress 1
@@ -3394,22 +3514,30 @@ namespace eval X {
# Raise nex tab or disable project menu and procedures
if {[llength $openedProjects] > 0} {
- set actualProject [lindex $openedProjects 0]
- .mainFrame.mainNB raise [string trimleft $actualProject {:}]
- } {
+ set actualProjectIdx 0
+ set actualProject [lindex $openedProjects $actualProjectIdx]
+ ${::main_nb} raise [string trimleft $actualProject {:}]
+ } else {
set project_menu_locked 1
Lock_project_menu
}
set critical_procedure_in_progress 0
+
+ update
+ foreach project $openedProjects {
+ $project bottomNB_redraw_pane
+ }
}
## Compile current file
- # @parm Bool = 0 - Force compilation -- ignore running critical procedure
- # @parm Bool = 0 - Start simulator after successful compilation
- # @parm Bool = 0 - Compile current file only (not the main file)
+ # @parm Bool force=0 - Force compilation -- ignore running critical procedure
+ # @parm Bool compilation_start_simulator=0 - Start simulator after successful compilation
+ # @parm Bool compile_this_file_only=0 - Compile current file only (not the main file)
# @return Bool - result or {}
- proc __compile args {
+ proc __compile {{force 0} {_compilation_start_simulator 0} {_compile_this_file_only 0}} {
+ variable simulator_enabled ;# List of booleans: Simulator engaged
+ variable actualProjectIdx ;# Index of the current project in $openedProjects
variable compilation_successfull ;# Bool: Compilation successfull
variable actualProject ;# Object: Current project
variable compilation_in_progress ;# Bool: Compiler engaged
@@ -3420,21 +3548,9 @@ namespace eval X {
variable compile_this_file_only ;# Bool: Compile the current file only
variable compilation_mess_project ;# Object: Project related to running compilation
- # Parse input arguments
- if {[lindex $args 0] == 1} {
- set force 1
- } {
- set force 0
- }
- if {[lindex $args 1] == 1} {
- set compilation_start_simulator 1
- } {
- set compilation_start_simulator 0
- }
- if {[lindex $args 2] == 1} {
- set compile_this_file_only 1
- } {
- set compile_this_file_only 0
+ # It is not allowed to compile the source code while simulator is engaged
+ if {[lindex $simulator_enabled $actualProjectIdx]} {
+ return {}
}
if {$project_menu_locked} {return}
@@ -3449,6 +3565,9 @@ namespace eval X {
return 0
}
+ set compile_this_file_only $_compile_this_file_only
+ set compilation_start_simulator $_compilation_start_simulator
+
# Compilation started
set compilation_mess_project $actualProject
set compilation_successfull 1
@@ -3466,7 +3585,7 @@ namespace eval X {
# Determinate name of file to compile
if {$compile_this_file_only} {
set input_file {}
- } {
+ } else {
set input_file [list \
[$actualProject cget -projectPath] \
[$actualProject cget -P_option_main_file] \
@@ -3475,7 +3594,7 @@ namespace eval X {
if {[lindex $input_file 1] == {}} {
set input_file [$actualProject editor_procedure {} getFileName {}]
set language [$actualProject editor_procedure {} get_language {}]
- } {
+ } else {
set ext [string trimleft [file extension [lindex $input_file 1]] {.}]
if {$ext == {c} || $ext == {h} || $ext == {cxx} || $ext == {cpp} || $ext == {cc}} {
set language 1
@@ -3491,7 +3610,7 @@ namespace eval X {
if {[regexp {\.[^\.]*$} $input_file_name input_file_extension]} {
regsub {\.[^\.]*$} $input_file_name {} input_file_name
set input_file_extension [string range $input_file_extension 1 end]
- } {
+ } else {
set input_file_extension {}
}
# Asjust file extension
@@ -3521,16 +3640,16 @@ namespace eval X {
## C language
if {$language == 1} {
- if {!${::PROGRAM_AVALIABLE(sdcc)} && !${::PROGRAM_AVALIABLE(sdcc-sdcc)}} {
+ if {!${::PROGRAM_AVAILABLE(sdcc)} && !${::PROGRAM_AVAILABLE(sdcc-sdcc)}} {
tk_messageBox \
-parent . \
-type ok \
-icon warning \
-title [mc "Compiler not found"] \
-message [mc "Unable to find sdcc, please install sdcc and restart MCU 8051 IDE"]
- } {
+ } else {
# Start compiler
- set compiler_pid [::ExternalCompiler::compile_C \
+ set compiler_pid [::ExternalCompiler::compile_C \
$cur_dir $input_file_name.$input_file_extension \
$iram_size $xram_size $code_size \
]
@@ -3539,26 +3658,26 @@ namespace eval X {
## Assembly language
} else {
- # Check if the choosen assembler is avaliable in the system
- set avaliable 0
+ # Check if the choosen assembler is available in the system
+ set available 0
switch -- $::ExternalCompiler::selected_assembler {
0 { ;# Native assembler
- set avaliable 1
+ set available 1
set assembler_name [mc "MCU 8051 IDE Native assembler"]
- set assembler_cmd {mcu8051ide --compile}
+ set assembler_cmd {mcu8051ide --assemble}
}
1 { ;# ASEM-51
- set avaliable ${::PROGRAM_AVALIABLE(asem)}
+ set available ${::PROGRAM_AVAILABLE(asem)}
set assembler_name "ASEM-51"
set assembler_cmd {asem}
}
2 { ;# ASL
- set avaliable ${::PROGRAM_AVALIABLE(asl)}
+ set available ${::PROGRAM_AVAILABLE(asl)}
set assembler_name "ASL"
set assembler_cmd {asl}
}
3 { ;# AS31
- set avaliable ${::PROGRAM_AVALIABLE(as31)}
+ set available ${::PROGRAM_AVAILABLE(as31)}
set assembler_name "AS31"
set assembler_cmd {as31}
}
@@ -3566,7 +3685,7 @@ namespace eval X {
error "Unknown internal error -- Invalid ID of the selected assembler"
}
}
- if {!$avaliable} {
+ if {!$available} {
tk_messageBox \
-parent . \
-type ok \
@@ -3587,7 +3706,7 @@ namespace eval X {
set ::Compiler::Settings::xram_size $xram_size
set ::Compiler::Settings::code_size $code_size
set ::PreProcessor::check_sfr_usage 1
- set ::PreProcessor::avaliable_SFR [string tolower [$actualProject cget -avaliable_SFR]]
+ set ::PreProcessor::available_SFR [string tolower [$actualProject cget -available_SFR]]
# Perform code compilation
if {[catch {
@@ -3602,7 +3721,7 @@ namespace eval X {
-icon error \
-type ok \
-title [mc "Compiler crash - MCU 8051 IDE"] \
- -message [mc "Compiler crased, we are terribly sorry about that.\n\nPlease report this bug via project web or mail to author and please don't forget to include source code on which this error occured."]
+ -message [mc "Compiler crashed, we are terribly sorry about that.\n\nPlease report this bug via project web or mail to author and please don't forget to include source code on which this error occurred."]
}
::Compiler::free_resources
set Compiler::Settings::ABORT_VARIABLE 0
@@ -3643,11 +3762,16 @@ namespace eval X {
# @parm String fail_callback - Procedure to call upon failed compilation
# @return void
proc compile_if_nessesary_and_callback {success_callback fail_callback} {
+ variable project_menu_locked ;# Bool: Indicates than there is at least one opened project
variable actualProject ;# Object: Current project
variable compilation_in_progress ;# Bool: Compiler engaged
variable compilation_success_callback ;# String: Indented for HW plugins
variable compilation_fail_callback ;# String: Indented for HW plugins
+ if {$project_menu_locked} {
+ return
+ }
+
set compilation_success_callback $success_callback
set compilation_fail_callback $fail_callback
@@ -3660,7 +3784,7 @@ namespace eval X {
set full_file_name [$actualProject editor_procedure {} getFileName {}]
set language [$actualProject editor_procedure {} get_language {}]
set relative_name [lindex $full_file_name 1]
- } {
+ } else {
set ext [string trimleft [file extension $relative_name] {.}]
if {$ext == {c} || $ext == {h} || $ext == {cxx} || $ext == {cpp} || $ext == {cc}} {
set language 1
@@ -3674,7 +3798,7 @@ namespace eval X {
set full_file_name [file rootname $full_file_name]
if {$language != 1} {
append full_file_name {.adf}
- } {
+ } else {
append full_file_name {.hashes}
}
@@ -3706,7 +3830,7 @@ namespace eval X {
}
}]} then {
- if {[verify_md5_hashes 1 $expected_md5s]} {
+ if {[verify_md5_hashes 1 $expected_md5s [file dirname $full_file_name]]} {
__compile
return
}
@@ -3739,7 +3863,7 @@ namespace eval X {
set compilation_fail_callback {}
set compilation_success_callback {}
}
- } {
+ } else {
Sbar [mc "Compilation failed"]
if {$compilation_fail_callback != {}} {
eval "$compilation_fail_callback"
@@ -3767,9 +3891,9 @@ namespace eval X {
"\{"] \
0 0]
- # Backspace charactes
+ # Backspace characters
set idx 0
- while 1 {
+ while {1} {
set idx [string first "\b" $args $idx]
if {$idx == -1} {
break
@@ -3810,6 +3934,7 @@ namespace eval X {
set actualProjectIdx $actualProjectIdx_org
} elseif {$compilation_start_simulator && !$compilation_successfull} {
tk_messageBox \
+ -parent . \
-icon error \
-type ok \
-title [mc "Compilation failed"] \
@@ -3829,18 +3954,25 @@ namespace eval X {
if {!$::MICROSOFT_WINDOWS} { ;# There is no kill command on Microsoft Windows
# Kill doxygen
- if {$doxygen_pid} {
+ if {${doxygen_pid} != {}} {
foreach pid $doxygen_pid {
+ if {$pid == [pid] || $pid == 0} {
+ continue
+ }
catch {
- exec -- kill -9 $pid &
+ exec -- kill -9 $pid
}
}
+ }
- # Kill SDCC
- } elseif {${compiler_pid} != {} && ${compiler_pid} != 0} {
+ # Kill external compiler
+ if {${compiler_pid} != {}} {
foreach pid $compiler_pid {
+ if {$pid == [pid] || $pid == 0} {
+ continue
+ }
catch {
- exec -- kill -9 $pid &
+ exec -- kill -9 $pid
}
}
}
@@ -3907,12 +4039,17 @@ namespace eval X {
## Append text to messages text (bottom panel - tab "Messages")
# @parm String text - Text to append
- # @return Bool - True if error occured
+ # @return Bool - True if error occurred
proc messages_text_append {text} {
variable actualProject ;# Object: Current project
variable compilation_mess_project ;# Object: Project related to running compilation
+ variable compilation_successfull ;# Bool: Compilation successfull
- return [$compilation_mess_project messages_text_append $text]
+ set result [$compilation_mess_project messages_text_append $text]
+ if {$result} {
+ set compilation_successfull 0
+ }
+ return $result
}
## Copy selected text in messages text to clipboard (bottom panel - tab "Messages")
@@ -3982,11 +4119,12 @@ namespace eval X {
[$actualProject editor_procedure {} getLinesCount {}] == 1
&&
[$actualProject editor_procedure {} getLineContent 1] == {}
- } {
+ } then {
tk_messageBox \
+ -parent . \
-type ok \
-icon warning \
- -title [mc "Unable to compile"] \
+ -title [mc "Unable to comply"] \
-message [mc "This editor seems to be empty"]
return
}
@@ -4000,13 +4138,13 @@ namespace eval X {
incr max
# Create diwlog window
- set win [toplevel .exportToX_dialog -class [mc "Export dialog"] -bg {#EEEEEE}]
+ set win [toplevel .exportToX_dialog -class [mc "Export dialog"] -bg ${::COMMON_BG_COLOR}]
wm withdraw $win
# Label and progress bar
set main_frame [frame $win.main_frame]
pack [label $main_frame.header \
- -text [mc "Finishing highlight ..."] \
+ -text [mc "Finishing syntax highlight ..."] \
] -pady 10 -padx 20 -anchor w
pack [ttk::progressbar $main_frame.progress_bar \
-maximum $max \
@@ -4022,20 +4160,20 @@ namespace eval X {
-command "X::exportToX_abort $targetType" \
-image ::ICONS::16::cancel \
-compound left \
- ]
+ ] -pady 5
# Determinate target file name
set file [$actualProject editor_procedure {} getFileName {}]
set filename [lindex $file 1]
if {[lindex $file 0] != {}} {
set dir [lindex $file 0]
- } {
+ } else {
set dir [$actualProject cget -projectPath]
}
regsub {\.[^\.]*$} $filename {} filename
if {$targetType == "-html"} {
set suffix {html}
- } {
+ } else {
set suffix {tex}
}
append filename {.} $suffix
@@ -4043,9 +4181,10 @@ namespace eval X {
KIFSD::FSD fsd \
-initialfile $filename -directory $dir \
-title [mc "Export as %s - MCU 8051 IDE" [lindex $args 1]] \
- -defaultmask 0 -multiple 0 -filetypes [subst "
- {{[mc {[string toupper $suffix] file}]} {*.$suffix}}
- {{[mc {All files}]} {*}}"]
+ -defaultmask 0 -multiple 0 -filetypes [list \
+ [list [mc [string toupper $suffix] {file}] "*.$suffix"] \
+ [list [mc "All files"] {*}] \
+ ]
fsd setokcmd {
set ::X::fsd_result [X::fsd get]
}
@@ -4065,6 +4204,7 @@ namespace eval X {
if {[file exists $filename] && [file isfile $filename]} {
if {![file writable $filename]} {
tk_messageBox \
+ -parent . \
-type ok \
-icon error \
-title [mc "Permission denied"] \
@@ -4080,7 +4220,8 @@ namespace eval X {
-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 {
+ exportToX_abort $targetType
return
}
# Create a backup file
@@ -4091,9 +4232,10 @@ namespace eval X {
# Open target file
if {[catch {
- set file [open $filename w 420]
- }]} {
+ set file [open $filename w 0640]
+ }]} then {
tk_messageBox \
+ -parent . \
-type ok \
-icon error \
-title [mc "Permission denied"] \
@@ -4107,7 +4249,7 @@ namespace eval X {
wm iconphoto $win ::ICONS::16::html
wm deiconify $win
wm title $win [mc "[lindex $args 1] - MCU 8051 IDE"]
- wm minsize $win 450 70
+ wm minsize $win 450 110
wm protocol $win WM_DELETE_WINDOW {
exportToX_abort
}
@@ -4130,9 +4272,9 @@ namespace eval X {
# Export and write data
if {$targetType == "-html"} {
- puts -nonewline $file [$actualProject editor_procedure {} getDataAsXHTML {}]
+ $actualProject editor_procedure {} getDataAsXHTML $file
} elseif {$targetType == "-latex"} {
- puts -nonewline $file [$actualProject editor_procedure {} getDataAsLaTeX {}]
+ $actualProject editor_procedure {} getDataAsLaTeX $file
} else {
error "Unknown argument: $targetType\n\tpossible vaues are: -html -latex"
}
@@ -4140,7 +4282,7 @@ namespace eval X {
exportToX_abort $targetType
# Show result
- Sbar [mc "Expoted data saved to %s" $filename]
+ Sbar [mc "Exported data saved to %s" $filename]
}
## Abort export content of the current editor as XHTML/LaTeX
@@ -4181,15 +4323,16 @@ namespace eval X {
# - Save all projects
# - Save session file
# - Exit
- # @parm Bool = 0 - Print message "Exitong on user request"
+ # @parm Bool do_not_print_exit_message=0 - Print message "Exiting on user request"
+ # @parm Bool force=0 - Do not allow user to cancel the request
# @return void
- proc __exit args {
+ proc __exit {{do_not_print_exit_message 0} {force 0}} {
variable openedProjects ;# List of opened projects (Object references)
variable actualProject ;# Object: Current project
variable compilation_in_progress ;# Bool: Compiler engaged
variable procedure_exit_in_progress ;# Bool: proc "__exit" in progress
variable unsaved_projects ;# List: List of project object marked as "unsaved"
- variable eightsegment_editors ;# List: All 8-segment LED display editors invoked
+ variable eightsegment_editors ;# List: All 8-Segment LED display editors invoked
variable spec_calc_objects ;# List: All special calculator objects
variable rs232debugger_objects ;# List: All "RS232 debugger" objects
@@ -4204,13 +4347,6 @@ namespace eval X {
}
set procedure_exit_in_progress 1
- # Parse arguments
- if {[lindex $args 0] == 1} {
- set do_not_print_exit_message 1
- } {
- set do_not_print_exit_message 0
- }
-
# Ask hardware whether it's ready for exit
foreach project $openedProjects {
if {![$project hw_manager_comfirm_exit]} {
@@ -4234,25 +4370,26 @@ namespace eval X {
set unsaved_projects {}
foreach project $openedProjects {
foreach editor [$project cget -editors] {
- if {[$editor cget -modified]} {
- lappend unsaved_projects "{$project} {$editor}"
+ catch {
+ if {[$editor cget -modified]} {
+ lappend unsaved_projects [list $project $editor]
+ }
}
}
}
# Ask user for saving unsaved files -- use proc 'shutdown_dialog'
if {[llength $unsaved_projects] != 0} {
- switch -- [shutdown_dialog] {
+ switch -- [shutdown_dialog $force] {
0 { ;# SAVESELECTED
set i 0
foreach unsaved $unsaved_projects {
- set bool [subst "\$::unsavedfile$i"]
+ set bool [subst -nocommands "\$::unsavedfile$i"]
if {$bool == 1} {
[lindex [lindex $unsaved_projects $i] 1] save
}
incr i
}
-
}
1 { ;# SAVEALL
set last_project {}
@@ -4272,10 +4409,22 @@ namespace eval X {
}
}
+ # Stop watching for modifications in designaded files
+ FSnotifications::stop
+
if {!$do_not_print_exit_message} {
puts [mc "\nExiting program on user request ..."]
}
+ # Save session
+ if {[catch {
+ save_session
+ } result]} then {
+ puts stderr [mc "An error occurred when saving the last session"]
+ puts stderr $result
+ }
+
+
# Withdraw main window
wm withdraw .
# Withdraw all PALE windows
@@ -4284,23 +4433,20 @@ namespace eval X {
}
update
- # Save session
- if {[catch {
- save_session
- } result]} then {
- puts stderr [mc "An error occured when saving the last session"]
- puts stderr $result
- }
-
# Save all projects
foreach project $openedProjects {
$project kill_childern
set actualProject $project
+ puts [mc "Saving project: %s" $project]
__proj_save
}
- puts [mc "Program terminated"]
+ # Kill the spell checker used by the editor
+ if {!$::MICROSOFT_WINDOWS} {
+ ::Editor::kill_spellchecker_process
+ }
+ puts [mc "Program terminated"]
exit
}
@@ -4327,7 +4473,7 @@ namespace eval X {
variable project_recent_files ;# List: recently opened projects
variable vhw_recent_files ;# List: recently opened Virtual HW files
- variable base_convertors ;# List: All base convertor objects
+ variable base_converters ;# List: All base converter objects
variable change_letter_case_options ;# Options (which fields should be adjusted)
@@ -4338,7 +4484,7 @@ namespace eval X {
-type ok \
-icon error \
-title [mc "Permission denied"] \
- -message [mc "Unable to save running config"]
+ -message [mc "Unable to save running configuration"]
return 0
}
}
@@ -4394,36 +4540,46 @@ namespace eval X {
RS232_DEBUGGER {${::RS232Debugger::config_list}}
STACK_MON_GEOMETRY {${::StackMonitor::geometry}}
STACK_MON_COLLAPSED {${::StackMonitor::collapsed}}
+ SPELL_CHECK_ENABLED {${::Editor::spellchecker_enabled}}
+ SPELL_CHECK_DICTIONARY {${::Editor::spellchecker_dictionary}}
+ UART_MON_GEOMETRY {${::UARTMonitor::geometry}}
+ SHOW_PALE_WARN {${::Graph::show_sim_per_warn}}
}]
set ::CONFIG(LETTER_CASE) {}
for {set i 0} {$i < 21} {incr i} {
lappend ::CONFIG(LETTER_CASE) $change_letter_case_options($i)
}
- set ::CONFIG(BASE_CONVERTORS) {}
- foreach obj $base_convertors {
- lappend ::CONFIG(BASE_CONVERTORS) [$obj get_config]
+ set ::CONFIG(BASE_CONVERTERS) {}
+ foreach obj $base_converters {
+ lappend ::CONFIG(BASE_CONVERTERS) [$obj get_config]
}
# Open session file
if {[catch {
- set file [open $session_file w 420]
+ set file [open $session_file w 0640]
}]} then {
- tk_messageBox -parent . -type ok -icon error \
- -title [mc "Access denied"] \
+ tk_messageBox \
+ -parent . \
+ -type ok \
+ -icon error \
+ -title [mc "Access denied"] \
-message [mc "Unable to write to file: \"%s\"" $session_file]
return
}
# Write session file
- puts $file "# ${::APPNAME} [clock format [clock seconds] -format {%T %D}]"
- puts $file "# Please do not modify this file manualy.\n"
+ puts $file "# ${::APPNAME}"
+ puts $file "# Please do not modify this file manually.\n"
puts $file "# booleans"
if {$::MICROSOFT_WINDOWS} {
- # There is no such thing on Windows OS
- puts $file "WINDOW_ZOOMED = \"0\""
- } {
- puts $file "WINDOW_ZOOMED = \"[wm attributes . -zoomed]\""
+ if {[wm state .] == {zoomed}} {
+ puts $file "WINDOW_ZOOMED = 1"
+ } else {
+ puts $file "WINDOW_ZOOMED = 0"
+ }
+ } else {
+ puts $file "WINDOW_ZOOMED = [wm attributes . -zoomed]"
}
puts $file "LINE_NUMBERS = $::CONFIG(LINE_NUMBERS)"
puts $file "ICON_BORDER = $::CONFIG(ICON_BORDER)"
@@ -4436,6 +4592,8 @@ namespace eval X {
puts $file "ASK_ON_FILE_OPEN = $::CONFIG(ASK_ON_FILE_OPEN)"
puts $file "SHOW_EDITOR_TAB_BAR = $::CONFIG(SHOW_EDITOR_TAB_BAR)"
puts $file "STACK_MON_COLLAPSED = $::CONFIG(STACK_MON_COLLAPSED)"
+ puts $file "SPELL_CHECK_ENABLED = $::CONFIG(SPELL_CHECK_ENABLED)"
+ puts $file "SHOW_PALE_WARN = $::CONFIG(SHOW_PALE_WARN)"
puts $file "\n# integers"
puts $file "LEFT_PANEL_SIZE = $::CONFIG(LEFT_PANEL_SIZE)"
puts $file "RIGHT_PANEL_SIZE = $::CONFIG(RIGHT_PANEL_SIZE)"
@@ -4450,6 +4608,7 @@ namespace eval X {
puts $file "FILE_RECENT_FILES = \"$::CONFIG(FILE_RECENT_FILES)\""
puts $file "PROJECT_RECENT_FILES = \"$::CONFIG(PROJECT_RECENT_FILES)\""
puts $file "VHW_RECENT_FILES = \"$::CONFIG(VHW_RECENT_FILES)\""
+ puts $file "SPELL_CHECK_DICTIONARY = \"$::CONFIG(SPELL_CHECK_DICTIONARY)\""
puts $file "\n# lists"
puts $file "CLEANUP_OPTIONS = \"[regsub -all {\s+} $::CONFIG(CLEANUP_OPTIONS) { }]\""
puts $file "FIND_OPTIONS = \"$::CONFIG(FIND_OPTIONS)\""
@@ -4467,7 +4626,7 @@ namespace eval X {
puts $file "REGWATCHES_CONFIG = \"$::CONFIG(REGWATCHES_CONFIG)\""
puts $file "FILE_NOTES = \"$::CONFIG(FILE_NOTES)\""
puts $file "EIGHT_SEG_EDITOR = \"$::CONFIG(EIGHT_SEG_EDITOR)\""
- puts $file "BASE_CONVERTORS = \"$::CONFIG(BASE_CONVERTORS)\""
+ puts $file "BASE_CONVERTERS = \"$::CONFIG(BASE_CONVERTERS)\""
puts $file "SPEC_CALC = \"$::CONFIG(SPEC_CALC)\""
puts $file "RS232_DEBUGGER = \"$::CONFIG(RS232_DEBUGGER)\""
puts $file "\n# other"
@@ -4475,12 +4634,11 @@ namespace eval X {
puts $file "ACTIVE_PROJECT = $actualProjectIdx"
puts $file "INTR_MON_GEOMETRY = \"$::CONFIG(INTR_MON_GEOMETRY)\""
puts $file "STACK_MON_GEOMETRY = \"$::CONFIG(STACK_MON_GEOMETRY)\""
+ puts $file "UART_MON_GEOMETRY = \"$::CONFIG(UART_MON_GEOMETRY)\""
- set projects {}
- if {[winfo exists .mainFrame.mainNB]} {
- set projects_len [llength [.mainFrame.mainNB pages]]
- for {set i 0} {$i < $projects_len} {incr i} {
- set prj [.mainFrame.mainNB pages $i]
+ set projects [list]
+ foreach prj $openedProjects {
+ if {![$prj cget -S_flag_read_only]} { ;# Do not reopen read-only projects
lappend projects [file join \
[$prj cget -projectPath]\
[$prj cget -projectFile]\
@@ -4548,7 +4706,9 @@ namespace eval X {
LETTER_CASE {- - - - - - - - - - - - - - - - - - - - -}
KIFSD_CONFIG {}
HEXEDIT_CONFIG {+0+0 hex 0 left}
- INTR_MON_GEOMETRY {780x250}
+ INTR_MON_GEOMETRY {850x270}
+ UART_MON_GEOMETRY {850x270}
+ SHOW_PALE_WARN 1
SUBP_MON_CONFIG {1 1}
OPEN_WITH_DLG {}
FS_BROWSER_MASK {*.asm}
@@ -4562,20 +4722,32 @@ namespace eval X {
FILE_RECENT_FILES {}
PROJECT_RECENT_FILES {}
VHW_RECENT_FILES {}
- REGWATCHES_CONFIG {1 1}
+ REGWATCHES_CONFIG {1 1 0}
FILE_NOTES {1 200}
EIGHT_SEG_EDITOR {
{0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7}
{0 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0}
}
- BASE_CONVERTORS {}
+ BASE_CONVERTERS {}
SPEC_CALC {}
ASK_ON_FILE_OPEN 1
SHOW_EDITOR_TAB_BAR 1
RS232_DEBUGGER {9600 n 8 1 1 0 {} {} 0 0}
STACK_MON_GEOMETRY {}
STACK_MON_COLLAPSED 1
+ SPELL_CHECK_ENABLED 1
+ SPELL_CHECK_DICTIONARY {}
}
+
+ # Set default dictionary for the spell checking
+ set ::CONFIG(SPELL_CHECK_DICTIONARY) [join \
+ [list \
+ [string tolower [lindex [split [::msgcat::mclocale] {_}] 0]] \
+ [string toupper [lindex [split [::msgcat::mclocale] {_}] 1]] \
+ ] \
+ {_} \
+ ]
+
if {$::MICROSOFT_WINDOWS} {
lset ::CONFIG(FIND_IN_FILES_CONFIG) 3 ${::env(USERPROFILE)}
}
@@ -4607,9 +4779,11 @@ namespace eval X {
STOPWATCH_CONFIG C_VARS_VIEW_CONF BITMAP_CONFIG
HW_MANAGER_CONFIG FILE_RECENT_FILES PROJECT_RECENT_FILES
REGWATCHES_CONFIG EIGHT_SEG_EDITOR VHW_RECENT_FILES
- BASE_CONVERTORS WINDOW_ZOOMED SPEC_CALC
+ BASE_CONVERTERS WINDOW_ZOOMED SPEC_CALC
ASK_ON_FILE_OPEN SHOW_EDITOR_TAB_BAR RS232_DEBUGGER
FILE_NOTES STACK_MON_GEOMETRY STACK_MON_COLLAPSED
+ SPELL_CHECK_ENABLED SPELL_CHECK_DICTIONARY UART_MON_GEOMETRY
+ SHOW_PALE_WARN
}
# List of datatypes for these keys
set datatypes {
@@ -4629,11 +4803,13 @@ namespace eval X {
S B S
B B S
S S B
+ B S G
+ B
}
# Open session file
set file [open $session_file r]
- while 1 {
+ while {1} {
# Break on EOF
if {[eof $file]} {
close $file
@@ -4706,9 +4882,9 @@ namespace eval X {
puts stderr "Invalid record REPLACE_OPTIONS -- setting to default value"
set ::CONFIG(REPLACE_OPTIONS) $default_REPLACE_OPTIONS
}
- if {![regexp {^\s*[01]\s+[01]\s*$} $::CONFIG(REGWATCHES_CONFIG)]} {
+ if {![regexp {^\s*[01]\s+[01]\s+[01]\s*$} $::CONFIG(REGWATCHES_CONFIG)]} {
puts stderr "Invalid record REGWATCHES_CONFIG -- setting to default value"
- set ::CONFIG(REGWATCHES_CONFIG) {1 1}
+ set ::CONFIG(REGWATCHES_CONFIG) {1 1 0}
}
# Adjust some configuration values
@@ -4751,18 +4927,19 @@ namespace eval X {
}
## Invoke dialog "Exit program"
+ # @parm Bool force=0 - Do not allow user to cancel the request
# @return Int - result
# '0' == Save selected
# '1' == Save all
# '2' == Discard
# '3' == Cancel
- proc shutdown_dialog {} {
+ proc shutdown_dialog {{force 0}} {
variable unsaved_projects ;# List: List of project object marked as "unsaved"
catch {unset ::exit_dialog_result}
# Create dialog window
- set dialog [toplevel .save_multiple_projects -class {Save multimple} -bg {#EEEEEE}]
+ set dialog [toplevel .save_multiple_projects -class {Save multimple} -bg ${::COMMON_BG_COLOR}]
# Create the top part of dialog (Header and some icon)
pack [frame $dialog.topframe] -fill x -expand 1
@@ -4774,7 +4951,7 @@ namespace eval X {
] -side right -fill x -expand 1
# Create the middle part of the dialog (list of unsaved files)
- pack [ttk::labelframe $dialog.lf -text [mc "Unsaved files"] -labelanchor nw -padding 5] -fill both -expand 1 -pady 10 -padx 10
+ ttk::labelframe $dialog.lf -text [mc "Unsaved files"] -labelanchor nw -padding 5
set last_project {}
set i 0
foreach unsaved $unsaved_projects {
@@ -4797,8 +4974,8 @@ namespace eval X {
}
# Create the bottom part of the dialog (buttons)
- pack [ttk::separator $dialog.separator -orient horizontal] -fill x -expand 1 -padx 10
- pack [frame $dialog.f] -pady 5 -padx 5
+ ttk::separator $dialog.separator -orient horizontal
+ frame $dialog.f
# button SAVESELECTED
pack [ttk::button $dialog.f.b_save_selected \
-text [mc "Save selected"] \
@@ -4830,15 +5007,22 @@ namespace eval X {
bind $dialog.f.b_discard <Return> {set ::exit_dialog_result 2}
bind $dialog.f.b_discard <KP_Enter> {set ::exit_dialog_result 2}
# button CANCEL
- pack [ttk::button $dialog.f.b_cancel \
- -text [mc "Cancel"] \
- -underline 0 \
- -compound left \
- -image ::ICONS::16::button_cancel \
- -command {set ::exit_dialog_result 3} \
- ] -side left -padx 5
- bind $dialog.f.b_cancel <Return> {set ::exit_dialog_result 3}
- bind $dialog.f.b_cancel <KP_Enter> {set ::exit_dialog_result 3}
+ if {!$force} {
+ pack [ttk::button $dialog.f.b_cancel \
+ -text [mc "Cancel"] \
+ -underline 0 \
+ -compound left \
+ -image ::ICONS::16::button_cancel \
+ -command {set ::exit_dialog_result 3} \
+ ] -side left -padx 5
+ bind $dialog.f.b_cancel <Return> {set ::exit_dialog_result 3}
+ bind $dialog.f.b_cancel <KP_Enter> {set ::exit_dialog_result 3}
+ }
+
+ # Pack GUI parts
+ pack $dialog.lf -fill both -expand 1 -pady 10 -padx 10
+ pack $dialog.separator -fill x -expand 1 -padx 10
+ pack $dialog.f -pady 5 -padx 5
# Set key-events bindings
bind $dialog <Alt-Key-s> {set ::exit_dialog_result 0}
@@ -4854,11 +5038,23 @@ namespace eval X {
grab $dialog
focus -force $dialog.f.b_save_all
wm transient $dialog .
- wm protocol $dialog WM_DELETE_WINDOW "
- grab release $dialog
- destroy $dialog
- set ::exit_dialog_result 3
- "
+ if {!$force} {
+ wm protocol $dialog WM_DELETE_WINDOW "
+ grab release $dialog
+ destroy $dialog
+ set ::exit_dialog_result 3
+ "
+ } else {
+ wm protocol $dialog WM_DELETE_WINDOW "
+ tk_messageBox \
+ -parent $dialog \
+ -type ok \
+ -icon warning \
+ -title {[mc {Attention}]} \
+ -message {[mc {You have to chose one action}]}
+ "
+
+ }
vwait ::exit_dialog_result
grab release $dialog
destroy $dialog
@@ -4899,7 +5095,7 @@ namespace eval X {
set lineNum [$actualProject simulator_getCurrentLine]
if {$lineNum != {}} {
$actualProject move_simulator_line $lineNum
- } {
+ } else {
$actualProject editor_procedure {} unset_simulator_line {}
}
$actualProject Simulator_sync_PC_etc
@@ -4941,7 +5137,7 @@ namespace eval X {
set lineNum [$actualProject step]
if {$lineNum != {}} {
$actualProject move_simulator_line $lineNum
- } {
+ } else {
$actualProject editor_procedure {} unset_simulator_line {}
}
stepback_button_set_ena [$actualProject simulator_get_SBS_len]
@@ -4988,7 +5184,7 @@ namespace eval X {
set lineNum [$actualProject sim_stepover]
if {$lineNum != {}} {
$actualProject move_simulator_line $lineNum
- } {
+ } else {
$actualProject editor_procedure {} unset_simulator_line {}
}
@@ -5070,7 +5266,7 @@ namespace eval X {
set line_num [$actualProject sim_run]
if {$line_num != {}} {
$actualProject move_simulator_line $line_num
- } {
+ } else {
$actualProject editor_procedure {} unset_simulator_line {}
}
# Adjust simulator control panel
@@ -5098,6 +5294,8 @@ namespace eval X {
variable critical_procedure_in_progress ;# Bool: Disables procedures which takes a long time
variable actualProjectIdx ;# Index of the current project in $openedProjects
variable project_menu_locked ;# Bool: Indicates than there is at least one opened project
+ variable opened_code_mem_windows ;# List of project object with opened CODE memory hex editor
+ variable code_mem_window_objects ;# List of CODE memory hex editor objects
if {$project_menu_locked} {return}
@@ -5116,7 +5314,7 @@ namespace eval X {
# Perform reset
$actualProject Simulator_reset $arg
$actualProject simulator_setWatchDogTimer 0
- # Move simulator cursor in editor to the begining of the program
+ # Move simulator cursor in editor to the beginning of the program
foreach editor [$actualProject cget -editors] {
$editor unset_simulator_line
}
@@ -5130,20 +5328,23 @@ namespace eval X {
$actualProject rightPanel_watch_sync_all
}
+ # Inform code memory hexadecimal editor about the reset
+ program_counter_changed $actualProject 0
+
# Finalize
set critical_procedure_in_progress 0
}
## Start/Shutdown simulator
- # @parm Bool = 0 - Load debug file for the current file only (not the main file)
+ # @parm Bool current_file_only=0 - Load debug file for the current file only (not the main file)
# @return void
- proc __initiate_sim args {
+ proc __initiate_sim {{current_file_only 0}} {
variable actualProject ;# Object: Current project
variable simulator_enabled ;# List of booleans: Simulator engaged
variable critical_procedure_in_progress ;# Bool: Disables procedures which takes a long time
variable actualProjectIdx ;# Index of the current project in $openedProjects
variable project_menu_locked ;# Bool: Indicates than there is at least one opened project
- variable opended_code_mem_windows ;# List of project object with opened CODE memory hex editor
+ variable opened_code_mem_windows ;# List of project object with opened CODE memory hex editor
variable code_mem_window_objects ;# List of CODE memory hex editor objects
if {$project_menu_locked} {return}
@@ -5152,12 +5353,6 @@ namespace eval X {
if {$critical_procedure_in_progress} {return}
set critical_procedure_in_progress 1
- if {[lindex $args 0] == 1} {
- set current_file_only 1
- } {
- set current_file_only 0
- }
-
# Clear program timer
$actualProject simulator_clear_overall_time
@@ -5185,7 +5380,7 @@ namespace eval X {
}
# Inform code memory hexadecimal editor about that
- set idx [lsearch -exact -ascii $opended_code_mem_windows [string trimleft $actualProject {:}]]
+ set idx [lsearch -exact -ascii $opened_code_mem_windows [string trimleft $actualProject {:}]]
if {$idx != -1} {
[lindex $code_mem_window_objects $idx] simulator_stared_stopped 0
}
@@ -5205,7 +5400,7 @@ namespace eval X {
set full_file_name [$actualProject editor_procedure {} getFileName {}]
set language [$actualProject editor_procedure {} get_language {}]
set relative_name [lindex $full_file_name 1]
- } {
+ } else {
set ext [string trimleft [file extension $relative_name] {.}]
if {$ext == {c} || $ext == {h} || $ext == {cxx} || $ext == {cpp} || $ext == {cc}} {
set language 1
@@ -5219,7 +5414,7 @@ namespace eval X {
set full_file_name [file rootname $full_file_name]
if {$language == 1} {
append full_file_name {.cdb}
- } {
+ } else {
append full_file_name {.adf}
}
@@ -5252,10 +5447,11 @@ namespace eval X {
}]} then {
# MD5 hash verification failed -> ask for recompilation
- if {($language == 0 || $language == 1) && [verify_md5_hashes 1 $expected_md5s]} {
+ if {($language == 0 || $language == 1) && [verify_md5_hashes 1 $expected_md5s [file dirname $full_file_name]]} {
# Ask for recompilation
set response [
tk_messageBox \
+ -parent . \
-icon question \
-type yesno \
-default {yes} \
@@ -5272,6 +5468,7 @@ namespace eval X {
# (0) Compilation failed
if {!$compilation_result} {
tk_messageBox \
+ -parent . \
-icon error \
-type ok \
-title [mc "Compilation failed"] \
@@ -5288,12 +5485,13 @@ namespace eval X {
# Ask for recompilation
set response [
tk_messageBox \
+ -parent . \
-icon question \
-type yesno \
-title [mc "File not found"] \
-message [mc "Simulator data file not found.\nDo you want create it ?"]
]
- if {$response == {no}} {
+ if {$response != {yes}} {
set critical_procedure_in_progress 0
return
}
@@ -5303,6 +5501,7 @@ namespace eval X {
# (0) Compilation failed
if {!$compilation_result} {
tk_messageBox \
+ -parent . \
-icon error \
-type ok \
-title [mc "Compilation failed"] \
@@ -5331,6 +5530,7 @@ namespace eval X {
set simulator_file [open $full_file_name r]
}]} then {
tk_messageBox \
+ -parent . \
-icon warning \
-type ok \
-title [mc "Unable to start simulator"] \
@@ -5361,7 +5561,7 @@ namespace eval X {
# Raise tab "Simulator" on the bottom panel
if {[lsearch {Graph Simulator CVarsView} $bottom_page_ID] == -1} {
$actualProject bottomNB_show_up {Simulator}
- } {
+ } else {
$actualProject bottomNB_show_up $bottom_page_ID
}
@@ -5382,7 +5582,7 @@ namespace eval X {
$actualProject cvarsview_load_cdb $simulator_file
}
close $hex_file
- } {
+ } else {
$actualProject load_program_from_adf $simulator_file
}
@@ -5421,11 +5621,14 @@ namespace eval X {
if {$found} {
$actualProject Simulator_import_breakpoints \
$filename [$editor getBreakpoints]
- } {
+ } else {
$actualProject Simulator_import_breakpoints $filename {}
}
}
+ # Detect and report invalid breakpoints
+ $actualProject report_invalid_breakpoints
+
$actualProject now_frozen
# Set simulator cursor in editor to the first OP code
@@ -5436,7 +5639,7 @@ namespace eval X {
stepback_button_set_ena 0 ;# Disable StepBack controls
# Inform code memory hexadecimal editor about that
- set idx [lsearch -exact -ascii $opended_code_mem_windows [string trimleft $actualProject {:}]]
+ set idx [lsearch -exact -ascii $opened_code_mem_windows [string trimleft $actualProject {:}]]
if {$idx != -1} {
[lindex $code_mem_window_objects $idx] simulator_stared_stopped 1
}
@@ -5449,11 +5652,12 @@ namespace eval X {
## Verify MD5 hashes for the given files (only for current project)
# @parm Bool save_files - Save modified files mentioned in the given list
# @parm List hashes - {hash filename hash filename ...}
+ # @parm String dir - Directory where the function will search for the files mentioned in "$hashes"
# @return Int - Final result
# 0 == All correct
# 1 == Verification failed
# 2 == File access error
- proc verify_md5_hashes {save_files hashes} {
+ proc verify_md5_hashes {save_files hashes dir} {
variable actualProject ;# Object: Current project
# Local variables
@@ -5461,8 +5665,6 @@ namespace eval X {
set filenames {} ;# List of filenames only
set md5_hashes {} ;# List of md5 hashes only
- set dir [$actualProject cget -projectPath]
-
# Separate filenames and hashes
for {set i 0; set j 1} {$i < $len} {incr i 2; incr j 2} {
lappend filenames [file join $dir [lindex $hashes $j]]
@@ -5503,9 +5705,10 @@ namespace eval X {
set recorded_md5 [lindex $md5_hashes $i]
if {[catch {
set computed_md5 [::md5::md5 -hex -file [lindex $filenames $i]]
- }]} {
+ }]} then {
return 2
}
+
if {$recorded_md5 != $computed_md5} {
return 1
}
@@ -5529,16 +5732,16 @@ namespace eval X {
# File name is not valid -> invoke error message
if {
- $input_file == {} ||
- ![file exists $input_file] ||
- ![file isfile $input_file] ||
- (!$::MICROSOFT_WINDOWS && ![file writable $input_file]) ||
- (!$::MICROSOFT_WINDOWS && ![file readable $input_file])
- } {
- tk_messageBox \
- -parent . -icon warning \
- -title [mc "Error - MCU 8051 IDE"] \
- -message [mc "Unable to gain unlimited access to the given file"]
+ $input_file == {} ||
+ ![file exists $input_file] ||
+ ![file isfile $input_file] ||
+ (!$::MICROSOFT_WINDOWS && ![file writable $input_file]) ||
+ (!$::MICROSOFT_WINDOWS && ![file readable $input_file])
+ } then {
+ tk_messageBox \
+ -parent . -icon warning \
+ -title [mc "Error - MCU 8051 IDE"] \
+ -message [mc "Unable to gain unlimited access to the given file"]
# File name is valid -> normalize its content
} else {
# Progress dialog
@@ -5570,11 +5773,11 @@ namespace eval X {
# Destroy progress dialog
catch {destroy .prgDl}
- # No errors occured -> rewrite file
+ # No errors occurred -> rewrite file
if {!${::IHexTools::error_count}} {
if {[catch {
- set file [open $input_file w 420]
- }]} {
+ set file [open $input_file w 0640]
+ }]} then {
tk_messageBox \
-type ok \
-icon error \
@@ -5586,10 +5789,10 @@ namespace eval X {
puts -nonewline $file $data
close $file
}
- # Errors occured -> Invoke error message dialog
+ # Errors occurred -> Invoke error message dialog
} else {
# Create dialog window
- set dialog [toplevel .error_message_dialog -class {Error dialog} -bg {#EEEEEE}]
+ set dialog [toplevel .error_message_dialog -class {Error dialog} -bg ${::COMMON_BG_COLOR}]
# Create main frame (text widget and scrolbar)
set main_frame [frame $dialog.main_frame]
@@ -5619,7 +5822,7 @@ namespace eval X {
# Set window attributes
wm iconphoto $dialog ::ICONS::16::status_unknown
- wm title $dialog [mc "Error(s) occured while parsing IHEX file - %s" ${::APPNAME}]
+ wm title $dialog [mc "Error(s) occurred while parsing IHEX file - %s" ${::APPNAME}]
wm minsize $dialog 500 250
wm protocol $dialog WM_DELETE_WINDOW [mc "grab release %s; destroy %s" $dialog $dialog]
wm transient $dialog .
@@ -5633,7 +5836,7 @@ namespace eval X {
}
}
- ## Invkoke dialog for converting Binary files to Intel® HEX 8 files
+ ## Invoke dialog for converting Binary files to Intel® HEX 8 files
# @return void
proc __bin2hex {} {
variable hex__bin ;# Type of conversion
@@ -5642,7 +5845,7 @@ namespace eval X {
hex2bin2hex
}
- ## Invkoke dialog for converting Intel® HEX 8 files to Binary files
+ ## Invoke dialog for converting Intel® HEX 8 files to Binary files
# @return void
proc __hex2bin {} {
variable hex__bin ;# Type of conversion
@@ -5650,7 +5853,7 @@ namespace eval X {
hex2bin2hex
}
- ## Invkoke dialog for converting Simulator data files to Intel® HEX 8 files
+ ## Invoke dialog for converting Simulator data files to Intel® HEX 8 files
# @return void
proc __sim2hex {} {
variable hex__bin ;# Type of conversion
@@ -5658,7 +5861,7 @@ namespace eval X {
hex2bin2hex
}
- ## Invkoke dialog for converting Simulator data files to Binary files
+ ## Invoke dialog for converting Simulator data files to Binary files
# @return void
proc __sim2bin {} {
variable hex__bin ;# Type of conversion
@@ -5675,13 +5878,13 @@ namespace eval X {
if {$critical_procedure_in_progress} {return}
# Create dialog window
- set win [toplevel .hex2bin2hex_dialog -class {Conversion} -bg {#EEEEEE}]
+ set win [toplevel .hex2bin2hex_dialog -class {Conversion} -bg ${::COMMON_BG_COLOR}]
set mainframe [frame $win.frame]
# Label, Entry and Button "Input file"
- grid [Label $mainframe.lbl_input \
- -text [mc "Input file"] \
- -helptext {File to convert} \
+ grid [Label $mainframe.lbl_input \
+ -text [mc "Input file"] \
+ -helptext [mc "File to convert"] \
] -column 1 -row 1 -sticky w
grid [ttk::entry $mainframe.entry_input \
-textvariable X::input_file \
@@ -5827,11 +6030,11 @@ namespace eval X {
# Normalize name of input file
if {!$::MICROSOFT_WINDOWS} { ;# POSIX way
if {![regexp "^(~|/)" $input_file]} {
- set filename "[${X::actualProject} cget -ProjectDir]/$input_file"
+ set filename "[${::X::actualProject} cget -ProjectDir]/$input_file"
}
- } { ;# Microsoft windows way
- if {![regexp "^\w:" $input_file]} {
- set filename [file join [${X::actualProject} cget -ProjectDir] $input_file]
+ } else { ;# Microsoft windows way
+ if {![regexp {^\w:} $input_file]} {
+ set filename [file join [${::X::actualProject} cget -ProjectDir] $input_file]
}
}
set input_file [file normalize $input_file]
@@ -5839,17 +6042,21 @@ namespace eval X {
# Normalize name of output file
if {!$::MICROSOFT_WINDOWS} { ;# POSIX way
if {![regexp "^(~|/)" $output_file]} {
- set filename "[${X::actualProject} cget -ProjectDir]/$output_file"
+ set filename "[${::X::actualProject} cget -ProjectDir]/$output_file"
}
- } { ;# Microsoft windows way
- if {![regexp "^\w:" $output_file]} {
- set filename [file join [${X::actualProject} cget -ProjectDir] $output_file]
+ } else { ;# Microsoft windows way
+ if {![regexp {^\w:} $output_file]} {
+ set filename [file join [${::X::actualProject} cget -ProjectDir] $output_file]
}
}
set output_file [file normalize $output_file]
set win .hex2bin2hex_dialog
+ bind $win <KeyRelease-Return> {}
+ bind $win <KeyRelease-KP_Enter> {}
+ bind $win <KeyRelease-Escape> {}
+
# Diable entry widgets in file selection dialog
foreach wdg [subst {
$win.frame.entry_input
@@ -5888,7 +6095,9 @@ namespace eval X {
if {[file exists $output_file] && [file isfile $output_file]} {
if {![file writable $output_file]} {
tk_messageBox \
- -type ok -icon error -parent $win \
+ -type ok \
+ -icon error \
+ -parent $win \
-title [mc "Permission denied"] \
-message [mc "Unable to access file: %s" $output_file]
hex2bin2hex_CANCEL
@@ -5902,7 +6111,7 @@ namespace eval X {
-title [mc "Overwrite file"] \
-message [mc "A file name '%s' already exists. Are you sure you want to overwrite it ?" [file tail $output_file]]
] != {yes}
- } {
+ } then {
hex2bin2hex_CANCEL
return
}
@@ -5922,6 +6131,7 @@ namespace eval X {
tk_messageBox \
-type ok \
-icon warning \
+ -parent $win \
-title [mc "File not found - MCU 8051 IDE"] \
-message [mc "Unable to open file '%s'" $input_file]
@@ -5934,6 +6144,7 @@ namespace eval X {
0 { ;# Bin -> Hex
$status_label configure -text [mc "Loading file ..."]
::IHexTools::load_bin_data $data
+ set data {}
if {!${::IHexTools::abort} && !${::IHexTools::error_count}} {
$status_label configure -text [mc "Saving file ..."]
$progressbar configure -maximum 16
@@ -5944,6 +6155,7 @@ namespace eval X {
$status_label configure -text [mc "Loading file ..."]
$progressbar configure -maximum [::IHexTools::get_number_of_iterations $data]
::IHexTools::load_hex_data $data
+ set data {}
if {!${::IHexTools::abort} && !${::IHexTools::error_count}} {
$status_label configure -text [mc "Saving file ..."]
$progressbar configure -maximum 16
@@ -5954,6 +6166,7 @@ namespace eval X {
$status_label configure -text [mc "Loading file ..."]
$progressbar configure -maximum [::IHexTools::get_number_of_iterations $data]
::IHexTools::load_sim_data $data
+ set data {}
if {!${::IHexTools::abort} && !${::IHexTools::error_count}} {
$status_label configure -text [mc "Saving file ..."]
$progressbar configure -maximum 16
@@ -5964,19 +6177,23 @@ namespace eval X {
$status_label configure -text [mc "Loading file ..."]
$progressbar configure -maximum [::IHexTools::get_number_of_iterations $data]
::IHexTools::load_sim_data $data
+ set data {}
if {!${::IHexTools::abort} && !${::IHexTools::error_count}} {
$status_label configure -text [mc "Saving file ..."]
$progressbar configure -maximum 16
set data [::IHexTools::get_bin_data]
}
}
+ default {
+ set data {}
+ }
}
# Write output file
- if {$data != {}} {
+ if {[string length $data]} {
if {[catch {
- set file [open $output_file w 420]
- }]} {
+ set file [open $output_file w 0640]
+ }]} then {
tk_messageBox \
-type ok \
-icon error \
@@ -5993,13 +6210,10 @@ namespace eval X {
}
}
- # If errors occured -> Invoke error message dialog
+ # If errors occurred -> Invoke error message dialog
if {${::IHexTools::error_count}} {
- # Destroy previous dialog
- hex2bin2hex_CANCEL
-
# Create dialog window
- set dialog [toplevel .error_message_dialog -class {Error dialog} -bg {#EEEEEE}]
+ set dialog [toplevel .error_message_dialog -class {Error dialog} -bg ${::COMMON_BG_COLOR}]
# Create main frame (text and scrollbar)
set main_frame [frame $dialog.main_frame]
@@ -6015,9 +6229,9 @@ namespace eval X {
pack $main_frame -fill both -expand 1
# Create button "Close"
- pack [ttk::button $dialog.ok_button \
- -text [mc "Close"] \
- -command "grab release $dialog; destroy $dialog" \
+ pack [ttk::button $dialog.ok_button \
+ -text [mc "Close"] \
+ -command "grab release $dialog; destroy $dialog"\
]
$text insert end ${::IHexTools::error_string}
@@ -6028,7 +6242,7 @@ namespace eval X {
wm title $dialog [mc "Corrupted file - MCU 8051 IDE"]
wm minsize $dialog 520 250
wm protocol $dialog WM_DELETE_WINDOW "grab release $dialog; destroy $dialog"
- wm transient $dialog .
+ wm transient $dialog .hex2bin2hex_dialog
grab $dialog
raise $dialog
tkwait window $dialog
@@ -6061,13 +6275,21 @@ namespace eval X {
proc select_input_output {io mask master} {
variable IO ;# Bool: 1 == choose input file; 0 == choose output file
variable actualProject ;# Object: Current project
+ variable openedProjects ;# List of opened projects (Object references)
+
set IO $io
+ if {[llength $openedProjects]} {
+ set project_dir [${::X::actualProject} cget -ProjectDir]
+ } else {
+ set project_dir ${::env(HOME)}
+ }
+
# Invoke the dialog
catch {delete object fsd}
KIFSD::FSD fsd \
-title [mc "Open file - MCU 8051 IDE"] \
- -directory [$actualProject cget -projectPath] \
+ -directory $project_dir \
-defaultmask 0 -multiple 0 -filetypes [list \
[list [mc "Input file"] "*.$mask"] \
[list [mc "All files"] {*}] \
@@ -6078,17 +6300,17 @@ namespace eval X {
set filename [X::fsd get]
if {!$::MICROSOFT_WINDOWS} { ;# POSIX way
if {![regexp "^(~|/)" $filename]} {
- set filename "[${X::actualProject} cget -ProjectDir]/$filename"
+ set filename "$project_dir/$filename"
}
- } { ;# Microsoft windows way
- if {![regexp "^\w:" $filename]} {
- set filename [file join [${X::actualProject} cget -ProjectDir] $filename]
+ } else { ;# Microsoft windows way
+ if {![regexp {^\w:} $filename]} {
+ set filename [file join $project_dir $filename]
}
}
set filename [file normalize $filename]
if {${X::IO}} {
set X::input_file $filename
- } {
+ } else {
set X::output_file $filename
}
}
@@ -6128,37 +6350,41 @@ namespace eval X {
set filename [X::fsd get]
if {!$::MICROSOFT_WINDOWS} { ;# POSIX way
if {![regexp "^(~|/)" $filename]} {
- set filename "[${X::actualProject} cget -ProjectDir]/$filename"
+ set filename "[${::X::actualProject} cget -ProjectDir]/$filename"
}
- } { ;# Microsoft windows way
- if {![regexp "^\w:" $filename]} {
- set filename [file join [${X::actualProject} cget -ProjectDir] $filename]
+ } else { ;# Microsoft windows way
+ if {![regexp {^\w:} $filename]} {
+ set filename [file join [${::X::actualProject} cget -ProjectDir] $filename]
}
}
set filename [file normalize $filename]
if {
- ![file exists $filename] ||
- ![file isfile $filename] ||
- (!$::MICROSOFT_WINDOWS && ![file readable $filename])
- } {
- tk_messageBox -type ok -icon warning \
- -parent [X::fsd get_window_name] \
- -title [mc "File not found - MCU 8051 IDE"] \
- -message [mc "The selected file %s does not exist." $filename]
+ ![file exists $filename] ||
+ ![file isfile $filename] ||
+ (!$::MICROSOFT_WINDOWS && ![file readable $filename])
+ } then {
+ tk_messageBox \
+ -type ok \
+ -icon warning \
+ -parent . \
+ -title [mc "File not found - MCU 8051 IDE"] \
+ -message [mc "The selected file %s does not exist." $filename]
} else {
set data [X::decompile $filename]
if {$data != {}} {
- ${X::actualProject} background_open $data
+ ${::X::actualProject} background_open $data
if {[lindex ${X::simulator_enabled} ${X::actualProjectIdx}] == 0} {
- ${X::actualProject} switch_to_last
+ ${::X::actualProject} switch_to_last
}
- } {
+ } else {
tk_messageBox \
- -type ok -icon warning \
- -title [mc "Decompilation failed"] \
- -message [mc "Decompilation failed -- see messages for details"]
+ -type ok \
+ -parent . \
+ -icon warning \
+ -title [mc "Disassembly failed"] \
+ -message [mc "Disassembly failed -- see messages for details"]
}
}
}
@@ -6184,8 +6410,10 @@ namespace eval X {
if {[catch {
set file [open $filename r]
}]} then {
- tk_messageBox -parent . \
- -icon warning -type ok \
+ tk_messageBox \
+ -parent . \
+ -icon warning \
+ -type ok \
-title [mc "Unable to open file"] \
-message [mc "Unable to read file '%s'" $filename]
return {}
@@ -6201,7 +6429,7 @@ namespace eval X {
set Compiler::Settings::TEXT_OUPUT_COMMAND X::messages_text_append
set Compiler::Settings::UPDATE_COMMAND {update}
- # Perform decompilation
+ # Perform disassembly
set data {}
set ::IHexTools::update 1
::IHexTools::load_hex_data [read $file]
@@ -6223,7 +6451,7 @@ namespace eval X {
messages_text_append [mc "FAILED"]
}
- # Free resources reserved during decompilation
+ # Free resources reserved during disassembly
::IHexTools::free_resources
return $data
@@ -6267,7 +6495,7 @@ namespace eval X {
if {$last_WIN_GEOMETRY == [wm geometry .]} {
return
# Refresh last window geometry variable
- } {
+ } else {
set last_WIN_GEOMETRY [wm geometry .]
}
@@ -6279,10 +6507,9 @@ namespace eval X {
set ::last_WIN_GEOMETRY_width ${::WIN_GEOMETRY_width}
foreach project $openedProjects {
catch {
- $project bottomNB_redraw_pane
- }
- catch {
$project leftpanel_redraw_pane
+ $project right_panel_redraw_pane
+ $project todo_panel_redraw_pane
}
}
}
@@ -6291,8 +6518,7 @@ namespace eval X {
set ::last_WIN_GEOMETRY_height ${::WIN_GEOMETRY_height}
foreach project $openedProjects {
catch {
- $project right_panel_redraw_pane
- $project todo_panel_redraw_pane
+ $project bottomNB_redraw_pane
}
}
}
@@ -6302,7 +6528,7 @@ namespace eval X {
# @return void
proc __about {} {
# Create dialog window
- set win [toplevel .about -class [mc "About dialog"] -bg {#EEEEEE}]
+ set win [toplevel .about -class [mc "About dialog"] -bg ${::COMMON_BG_COLOR}]
# Create dialog header
pack [label $win.header \
@@ -6314,18 +6540,29 @@ namespace eval X {
-family {helvetica}]
] -side top -pady 5
+ # Display short information about current translation
+ set translation_info "Translated into _Language_ by _Name_ (_country_) <_email_>"
+ if {[mc $translation_info] != $translation_info} {
+ pack [label $win.trans_info \
+ -text [mc $translation_info] \
+ -font [font create \
+ -size -12 \
+ -family {helvetica}]
+ ] -side top -pady 2
+ }
+
+
# Create notebook
- set nb [ttk::notebook $win.nb]
+ set nb [ModernNoteBook $win.nb]
# Create tab "About"
- set about_tab [frame $nb.about_tab]
- $nb add $about_tab -text [mc "About"]
- pack [text $about_tab.text \
- -width 0 -height 0 -cursor left_ptr \
- -yscrollcommand "$about_tab.scrollbar set" \
- -font [font create \
- -size -12 \
- -family {helvetica}] \
+ set about_tab [$nb insert end {About} -text [mc "About"]]
+ pack [text $about_tab.text \
+ -width 0 -height 0 -cursor left_ptr \
+ -yscrollcommand "$about_tab.scrollbar set" \
+ -font [font create \
+ -size [expr {int(-12 * $::font_size_factor)}] \
+ -family {helvetica}] \
] -fill both -expand 1 -side left
pack [ttk::scrollbar $about_tab.scrollbar \
-orient vertical \
@@ -6333,24 +6570,21 @@ namespace eval X {
] -fill y -side right
# fill in the about tab
$about_tab.text insert end "${::APPNAME}\n"
- $about_tab.text insert end [mc "\tComplete IDE for MCS-51 based microconrollers.\n"]
- $about_tab.text insert end [mc "\tThis program is witten for POSIX Systems\n"]
+ $about_tab.text insert end [mc "An open source IDE for MCS-51 based microconrollers for POSIX Systems, this software is licenced under the GNU GPL v2 licence. You can find more at the project web page http://mcu8051ide.sourceforge.net\n"]
+ $about_tab.text insert end "\n(c) 2007, 2008, 2009, 2010, 2011, 2012 Martin Ošmera <mailto:martin.osmera@gmail.com>\n"
if {$::MICROSOFT_WINDOWS} {
- $about_tab.text insert end [mc "\tYOU ARE CURRENTLY USING VERSION FOR Microsoft® Windows®\n"]
+ $about_tab.text insert end "\n"
+ $about_tab.text insert end [mc "You are currently using version for Microsoft® Windows®.\n"]
+ $about_tab.text insert end "(This version was made using the FreeWrap tool, by Dennis R. LaBelle <freewrapmgr@users.sourceforge.net>.)\n"
}
- $about_tab.text insert end "\n(c) Martin Ošmera <martin.osmera@gmail.com>\n"
- $about_tab.text insert end [mc "Web: http://mcu8051ide.sourceforge.net\n"]
- $about_tab.text insert end [mc "Please post suggestions and comments at http://mcu8051ide.sf.net\n"]
- $about_tab.text insert end [mc "\n\nThanks to Kostya V. Ivanov for bug fixes.\n"]
- $about_tab.text insert end [mc "Thanks to SDCC development team for their great work !\n"]
- $about_tab.text insert end [mc "Thanks to %s for their help during development\n" "Fabricio Alcalde, Shakthi Kannan, Miroslav Hradílek, Kostya V. Ivanov"]
+ create_link_tag_in_text_widget $about_tab.text
+ convert_all_https_to_links $about_tab.text
# Finalize text widget creation
$about_tab.text configure -state disabled
# Create tab "Thanks to"
- set thanks_tab [frame $nb.thanks_tab]
- $nb add $thanks_tab -text [mc "Thanks to"]
+ set thanks_tab [$nb insert end {Thanks} -text [mc "Thanks to"]]
pack [text $thanks_tab.text \
-width 0 -height 0 -cursor left_ptr \
-yscrollcommand "$thanks_tab.scrollbar set" \
@@ -6360,73 +6594,44 @@ namespace eval X {
-command "$thanks_tab.text yview" \
] -fill y -side right
-
- $thanks_tab.text insert end [mc "Thanks to Fabricio Alcalde for bug reports and suggestions\n"]
- $thanks_tab.text insert end [mc "Thanks to Miroslav Hradílek for bug reports\n"]
+ $thanks_tab.text insert end [mc "Special thanks to Kara Blackowiak (USA) for submitting various help file fixes.\n\n"]
+ $thanks_tab.text insert end [mc "Thanks to Yuanhui Zhang for bug reports and help with debugging.\n"]
+ $thanks_tab.text insert end [mc "Thanks to Fabricio Alcalde for bug reports and suggestions.\n"]
+ $thanks_tab.text insert end [mc "Thanks to Marek Nožka for help with debugging.\n"]
+ $thanks_tab.text insert end [mc "Thanks to Miroslav Hradílek for bug reports.\n"]
+ $thanks_tab.text insert end [mc "Thanks to Trevor Spiteri for help with debugging (patches) the HD44780 simulator.\n"]
$thanks_tab.text insert end [mc "Thanks to Kostya V. Ivanov for significant bug fixes.\n"]
- $thanks_tab.text insert end [mc "Thanks to Shakthi Kannan for including this IDE in FEL\n\n"]
- $thanks_tab.text insert end [mc "SDCC developers:\n"]
- $thanks_tab.text insert end "\tBela Torok\n"
- $thanks_tab.text insert end "\tBernhard Held\n"
- $thanks_tab.text insert end "\tBorut Ražem\n"
- $thanks_tab.text insert end "\tDave Helton\n"
- $thanks_tab.text insert end "\tDaniel Drotos\n"
- $thanks_tab.text insert end "\tErik Petrich\n"
- $thanks_tab.text insert end "\tFrieder Ferlemann\n"
- $thanks_tab.text insert end "\tHans Dorn\n"
- $thanks_tab.text insert end "\tJerome Bessiere\n"
- $thanks_tab.text insert end "\tJesus Calvino-Fraga\n"
- $thanks_tab.text insert end "\tJohan Knol\n"
- $thanks_tab.text insert end "\tAlex Karahalios\n"
- $thanks_tab.text insert end "\tKarl Bongers\n"
- $thanks_tab.text insert end "\tKlaus Flittner\n"
- $thanks_tab.text insert end "\tKlaus Martin Hennemann\n"
- $thanks_tab.text insert end "\tKevin Vigor\n"
- $thanks_tab.text insert end "\tMaarten Brock\n"
- $thanks_tab.text insert end "\tMartin Dubuc\n"
- $thanks_tab.text insert end "\tMartin Helmling\n"
- $thanks_tab.text insert end "\tMichael Hope\n"
- $thanks_tab.text insert end "\tMichael Schmitt\n"
- $thanks_tab.text insert end "\tPaul Stoffregen\n"
- $thanks_tab.text insert end "\tSandeep Dutta\n"
- $thanks_tab.text insert end "\tScott Dattalo\n"
- $thanks_tab.text insert end "\tErik Petrich\n"
- $thanks_tab.text insert end "\tStephen M. Kenton\n"
- $thanks_tab.text insert end "\tSlade Rich\n"
- $thanks_tab.text insert end "\tShawn Masters\n"
- $thanks_tab.text insert end "\tPhilipp Krause\n"
- $thanks_tab.text insert end "\tStephen Williams\n"
- $thanks_tab.text insert end "\tRaphael Neider\n"
- $thanks_tab.text insert end "\tAnton Voloshin\n"
- $thanks_tab.text insert end "\tVangelis Rokas\n"
- $thanks_tab.text insert end "\tWim Lewis\n"
- $thanks_tab.text insert end [mc "\n(Please post suggestions to %s)\n" "martin.osmera@gmail.com"]
+ $thanks_tab.text insert end [mc "Thanks to Shakthi Kannan for including this IDE in FEL.\n\n"]
+ $thanks_tab.text insert end [mc "Thanks to all the SDCC developers.\n"]
$thanks_tab.text configure -state disabled
- # Create tab "Licence"
- set licence_tab [frame $nb.licence_tab]
- $nb add $licence_tab -text [mc "Licence"]
- pack [text $licence_tab.text \
- -width 0 -height 0 \
- -yscrollcommand "$licence_tab.scrollbar set" \
+ # Create tab "License"
+ set license_tab [$nb insert end {License} -text [mc "License"]]
+ pack [text $license_tab.text \
+ -width 0 -height 0 \
+ -yscrollcommand "$license_tab.scrollbar set" \
+ -font [font create \
+ -family $::DEFAULT_FIXED_FONT \
+ -size -12 \
+ ] \
] -fill both -expand 1 -side left
- pack [ttk::scrollbar $licence_tab.scrollbar \
+ pack [ttk::scrollbar $license_tab.scrollbar \
-orient vertical \
- -command "$licence_tab.text yview" \
+ -command "$license_tab.text yview" \
] -fill y -side right
- # Fill in the licence tab
- if {[file exists "${::LIB_DIRNAME}/../data/licence.txt"]} {
- $licence_tab.text insert end [read [open "${::LIB_DIRNAME}/../data/licence.txt" {r}]]
- } {
- $licence_tab.text insert end [mc "FILE \"licence.txt\" WAS NOT FOUND\n\n"]
- $licence_tab.text insert end [mc "Text of the licence agreement is not availble,\n"]
- $licence_tab.text insert end [mc "please check your instalation."]
+ # Fill in the license tab
+ if {[file exists "${::ROOT_DIRNAME}/data/license.txt"]} {
+ $license_tab.text insert end [read [open "${::ROOT_DIRNAME}/data/license.txt" {r}]]
+ } else {
+ $license_tab.text insert end [mc "FILE \"license.txt\" WAS NOT FOUND\n\n"]
+ $license_tab.text insert end [mc "Text of the license agreement is not available,\n"]
+ $license_tab.text insert end [mc "please check your installation."]
}
- $licence_tab.text configure -state disabled
+ $license_tab.text configure -state disabled
# Pack NoteBook
- pack $nb -fill both -expand 1 -side top -padx 10
- $nb select $about_tab
+ pack [$nb get_nb] -fill both -expand 1 -side top -padx 10
+ $nb raise {About}
# Create button "Close"
pack [ttk::button $win.close \
-text [mc "Close"] \
@@ -6487,19 +6692,19 @@ namespace eval X {
-parent . \
-icon warning \
-type ok \
- -title [mc "Sorry, unable to compile"] \
+ -title [mc "Sorry, unable to comply"] \
-message [mc "Unable to indent C source without program indent, MCU 8051 IDE is unable to localize this program on Microsoft Windows operating system. So this feature is not available in version for MS Windows. Correction of this limitation is planed but right now it's not available."]
set critical_procedure_in_progress 0
return
}
# Check for program "indent"
- if {!${::PROGRAM_AVALIABLE(indent)}} {
+ if {!${::PROGRAM_AVAILABLE(indent)}} {
tk_messageBox \
-parent . \
-icon warning \
-type ok \
- -title [mc "Unable to compile"] \
+ -title [mc "Unable to comply"] \
-message [mc "Unable to indent C source without program indent, please install indent and restart MCU 8051 IDE."]
set critical_procedure_in_progress 0
return
@@ -6520,14 +6725,14 @@ namespace eval X {
-parent . \
-icon warning \
-type ok \
- -title [mc "Unable to compile"] \
+ -title [mc "Unable to comply"] \
-message [mc "Unable to indent C source code.\n\n%s" $result]
- } {
+ } else {
$actualProject filelist_reload_file
}
# Assembly language
- } {
+ } else {
# Prepare
set reformat_code_abort 0 ;# Reset auto indention abort flag
set editor_lines [$actualProject editor_linescount] ;# Number of lines in the editor
@@ -6545,10 +6750,10 @@ namespace eval X {
create_progress_bar .prgDl \
. \
{} \
- "Reformating code" \
+ [::mc "Reformatting code"] \
::X::compilation_progress \
$max \
- [mc "Reformating code"] \
+ [mc "Reformatting code"] \
::ICONS::16::filter \
[mc "Abort"] \
{::X::reformat_code_stop}
@@ -6568,7 +6773,9 @@ namespace eval X {
$editor configure -autoseparators 1
# Finalize
- catch {destroy .prgDl ;# Destroy progress dialog}
+ catch {
+ destroy .prgDl ;# Destroy progress dialog
+ }
}
set critical_procedure_in_progress 0
}
@@ -6591,7 +6798,8 @@ namespace eval X {
set new_content {} ;# Resulting string
# Parse input data (line by line)
- foreach line [split $data "\n"] {
+ set data [split $data "\n"]
+ foreach line $data {
if {$reformat_code_abort} {break} ;# Conditional abort
incr idx ;# Increment line number
@@ -6612,7 +6820,7 @@ namespace eval X {
# Determinate line with replaced strings and chars with underscores
set line_tmp $line
- while 1 {
+ while {1} {
if {![regexp {'[^']+'} $line_tmp str]} {break}
set len [string length $str]
regsub {'[^']+'} $line_tmp [string repeat {_} $len] line_tmp
@@ -6626,7 +6834,7 @@ namespace eval X {
set line [string range $line 0 [expr {$commentBegin - 1}]]
}
- # Determinate fields 0..2
+ # Determinate fields 0 and 1
set pos 0
for {set j 0} {$j < 2} {incr j} {
if {![regexp {^\s*[^\s]+} $line_tmp str]} {break}
@@ -6642,32 +6850,46 @@ namespace eval X {
# Remove leading white space from Field 2
set field_2 [regsub {^\s+} $line {}]
+ # Handle situation when there is no space between label and the 1st field
+ if {[regexp {[^\s:]+:[^\s:]+} $field_0]} {
+ set j [string first {:} $field_0]
+ append field_1 $field_2
+ set field_2 $field_1
+ set field_1 [string range $field_0 [expr {$j + 1}] end]
+ set field_0 [string range $field_0 0 $j]
+ }
+
# Field 1 >> Field 2; Field 0 -> Field 1; "" -> Field 0;
+ if {[string index $field_1 0] == {.}} {
+ set field_1_without_leading_dot [string range $field_1 1 end]
+ } else {
+ set field_1_without_leading_dot $field_1
+ }
if {
- [regexp {^\w+$} $field_0] &&
- ![regexp {^\d} $field_0] &&
- [lsearch -exact -ascii ${::ASMsyntaxHighlight::directive_type2} \
- [string toupper $field_1]] == -1
- } {
- append field_1 $field_2
- set field_2 $field_1
- set field_1 {}
- if {[string toupper $field_0] != {ENDM}} {
- set field_1 $field_0
- set field_0 {}
- }
+ [regexp {^\.?\w+$} $field_0] &&
+ ![regexp {^\d} $field_0] &&
+ [lsearch -exact -ascii ${::ASMsyntaxHighlight::directive_type2} \
+ [string toupper $field_1_without_leading_dot]] == -1
+ } then {
+ append field_1 $field_2
+ set field_2 $field_1
+ set field_1 {}
+ if {[string toupper $field_0] != {ENDM} && [string toupper $field_0] != {.ENDM}} {
+ set field_1 $field_0
+ set field_0 {}
+ }
}
# If line contains only comment then Field 3 -> Field 1
if {
- $field_3 != {} &&
- $field_0 == {} &&
- $field_1 == {} &&
- $field_2 == {} &&
- $commentBegin != 0
- } {
- set field_1 $field_3
- set field_3 {}
+ $field_3 != {} &&
+ $field_0 == {} &&
+ $field_1 == {} &&
+ $field_2 == {} &&
+ $commentBegin != 0
+ } then {
+ set field_1 $field_3
+ set field_3 {}
}
# Adjust space between operans/arguments
@@ -6675,13 +6897,13 @@ namespace eval X {
if {$field_2 != {}} {
# Strings/Chars to underscores
set field_2_tmp $field_2
- while 1 {
+ while {1} {
if {![regexp {'[^']+'} $field_2_tmp str]} {break}
set len [string length $str]
regsub {'[^']+'} $field_2_tmp [string repeat {_} $len] field_2_tmp
}
# Recomposite Field 2
- while 1 {
+ while {1} {
set i [string first {,} $field_2_tmp]
if {$i == -1} {
append field_2_new {, }
@@ -6714,7 +6936,7 @@ namespace eval X {
set correction 0
set falseLength [string length $line]
- while 1 {
+ while {1} {
set i [string first "\t" $line [expr {$i + 1}]]
if {$i == -1} {break}
@@ -6756,18 +6978,18 @@ namespace eval X {
if {$critical_procedure_in_progress} {return}
# Create dialog window
- set win [toplevel .cleanup -class [mc "Options dialog"] -bg {#EEEEEE}]
+ set win [toplevel .cleanup -class [mc "Options dialog"] -bg ${::COMMON_BG_COLOR}]
set bottom_frame [frame $win.buttonFrame]
set status_bar_lbl [label $bottom_frame.status_bar \
-justify left -anchor w \
]
# Create label frames
- set backup_labelframe [ttk::labelframe $win.backup_labelframe\
- -text [mc "Backup files"] \
+ set backup_labelframe [ttk::labelframe $win.backup_labelframe \
+ -text [mc "Backup files"] \
]
set other_labelframe [ttk::labelframe $win.other_labelframe \
- -text [mc "Other files"] \
+ -text [mc "Other files"] \
]
set i 0 ;# Checkbutton index
@@ -6794,7 +7016,7 @@ namespace eval X {
{HTML files}
{TeX sources}
{Register watches definition files}
- {MCU 8051 IDE Project}
+ {MCU 8051 IDE project}
{Hibernated programs}
{SDCC debug files}
{SDCC IHEX8 object files}
@@ -6804,7 +7026,7 @@ namespace eval X {
{C sources}
{C headers}
{Virtual Hardware Component}
- {Virtual HardWare}
+ {Virtual Hardware}
{Text files}
{All backup files}
} \
@@ -6816,7 +7038,11 @@ namespace eval X {
-variable __cleanup_$ID \
]
grid $button -row $row -column $col -sticky w -padx 5
- if {[lindex $::CONFIG(CLEANUP_OPTIONS) $i] != {0}} {$button select} {$button deselect}
+ if {[lindex $::CONFIG(CLEANUP_OPTIONS) $i] != {0}} {
+ $button select
+ } else {
+ $button deselect
+ }
bind $button <Enter> "$status_bar_lbl configure -text {$helptext}"
bind $button <Leave> "$status_bar_lbl configure -text {}"
@@ -6850,7 +7076,7 @@ namespace eval X {
{TeX sources}
{Hibernated programs}
{ASL: NoICE-compatible command file}
- {ASL: Atmel debub file used by the AVR tools}
+ {ASL: Atmel debug file used by the AVR tools}
{SDCC: The memory map for the load module}
{ASL object files}
{Macro definition file}
@@ -6862,7 +7088,7 @@ namespace eval X {
{SDCC debug files}
{SDCC: A file with a summary of the memory usage}
{SDCC: Linker script}
- {SDCC: Symbol listing for the sourcefile}
+ {SDCC: Symbol listing for the source file}
{OMF-51 object files}
{SDCC: Listing file updated with linkedit information}
{MD5 hashes for C source files}
@@ -6876,7 +7102,11 @@ namespace eval X {
-variable __cleanup__$ID \
]
grid $button -row $row -column $col -sticky w -padx 5
- if {[lindex $::CONFIG(CLEANUP_OPTIONS) $i] != {0}} {$button select} {$button deselect}
+ if {[lindex $::CONFIG(CLEANUP_OPTIONS) $i] != {0}} {
+ $button select
+ } else {
+ $button deselect
+ }
bind $button <Enter> "$status_bar_lbl configure -text {$helptext}"
bind $button <Leave> "$status_bar_lbl configure -text {}"
@@ -6909,13 +7139,13 @@ namespace eval X {
-compound left \
-image ::ICONS::16::ok \
-command {X::cleanup_OK} \
- ] -side left
+ ] -side left -padx 2
pack [ttk::button $win.buttonFrame.cancel \
-text [mc "Cancel"] \
-compound left \
-image ::ICONS::16::button_cancel \
-command {X::cleanup_CANCEL} \
- ] -side left
+ ] -side left -padx 2
pack $bottom_frame -pady 5 -fill x -padx 5
# Events binding (Enter == Ok; Esc == Cancel)
@@ -6949,74 +7179,95 @@ namespace eval X {
# @return void
proc cleanup_OK {} {
variable cleanup_masks ;# GLOB patterns
+ variable cleanup_files ;# List: Files marked for potential removal
variable actualProject ;# Object: Current project
- # Invoke confirmation dialog
- if {
- ![tk_messageBox \
- -parent . \
- -icon question \
- -type yesno \
- -title [mc "Cleanup project folder"] \
- -message [mc "Are you sure ?"]
- ]
- } {
- return
- }
-
# Determinate list of GLOB expressions of selected for removal
set dir [$actualProject cget -projectPath]
- set files [list]
+ set cleanup_files [list]
foreach mask $cleanup_masks bool $::CONFIG(CLEANUP_OPTIONS) {
if {$bool} {
- lappend files $mask
+ lappend cleanup_files $mask
}
}
# Determinate list of files selected for removal
set files_n [list]
catch { ;# For Microsoft Windows it has to be enclosed by catch
- foreach f $files {
+ foreach f $cleanup_files {
append files_n { } [glob -directory $dir -nocomplain -type f $f]
}
}
- set files $files_n
+ set cleanup_files [lsort -unique $files_n]
+
+ # Finalize
+ cleanup_ask
+ }
+
+ ## Proceed with the project folder clean up
+ # @return void
+ proc cleanup_PROCEED {} {
+ variable cleanup_files ;# List: Files marked for potential removal
+
+ # Invoke confirmation dialog
+ if {
+ [tk_messageBox \
+ -parent .cleanup_ask \
+ -icon question \
+ -type yesno \
+ -title [mc "Cleanup project folder"] \
+ -message [mc "Are you sure ?"] \
+ ] != {yes}
+ } then {
+ return
+ }
# Remove the specified files
- set result {}
- foreach file $files {
- if {![catch {
+ set count 0
+ foreach file $cleanup_files {
+ if {[catch {
file delete -force -- $file
- }]} {
- lappend result $file
+ }]} then {
+ puts stderr "Unable to delete file: $file"
+ } else {
+ incr count
}
}
- # Finalize
+ tk_messageBox \
+ -parent .cleanup_ask \
+ -icon info \
+ -type ok \
+ -title [mc "Cleanup project folder"] \
+ -message [mc "%d file(s) removed." $count]
+
cleanup_CANCEL ;# Close dialog window
- cleanup_finish $result ;# Invoke results dialog
}
## Close dialog "Clean up project folder" -- auxiliary procedure for 'cleanup_OK'
# @return void
proc cleanup_CANCEL {} {
+ variable cleanup_files ;# List: Files marked for potential removal
+ set cleanup_files [list]
+
destroy .cleanup
}
## Show results of files removal -- auxiliary procedure for 'cleanup_OK'
- # @parm List files - list of removed files
# @return void
- proc cleanup_finish {files} {
+ proc cleanup_ask {} {
+ variable cleanup_files ;# List: Files marked for potential removal
+
# Create dialog window
- set win [toplevel .cleanup_finish -class {Results} -bg {#EEEEEE}]
+ set win [toplevel .cleanup_ask -class {Confirmation dialog} -bg ${::COMMON_BG_COLOR}]
# Create window header
- pack [label $win.header_label \
- -text [mc "These files were removed"] \
- -font [font create \
- -size -20 \
+ pack [label $win.header_label \
+ -text [mc "These files will be removed"] \
+ -font [font create \
+ -size [expr {int(-20 * $::font_size_factor)}] \
-family {helvetica}]
- ] -anchor center
+ ] -anchor center -side top -fill x
# Create top frame (text widget and scrollbar)
set frame [frame $win.top_frame]
@@ -7033,7 +7284,12 @@ namespace eval X {
]
# Fill in the text widget
- foreach txt $files {
+ foreach txt $cleanup_files {
+ # On MS Windows change '/' to '\' in file path
+ if {$::MICROSOFT_WINDOWS} {
+ regsub -all {/} $txt "\\" txt
+ }
+
$text insert end $txt
$text insert end "\n"
}
@@ -7042,20 +7298,27 @@ namespace eval X {
# Pack scrollbar and the text widget
pack $scrollbar -side right -fill y
pack $text -side left -fill both -expand 1
+ pack $frame -side top -fill both -expand 1 -pady 5 -padx 5
# Pack the top frame and create button "Ok"
- pack $frame -fill both -expand 1
- pack [ttk::button $win.ok_button \
- -text [mc "Ok"] \
+ set but_frame [frame $win.but_frame]
+ pack [ttk::button $but_frame.ok_button \
+ -text [mc "Proceed"] \
-compound left \
-image ::ICONS::16::ok \
- -command "destroy $win" \
- ] -anchor center -side bottom
-
- # Events binding (Enter/Escape == Ok)
- bind $win <KeyRelease-Return> "destroy $win; break"
- bind $win <KeyRelease-KP_Enter> "destroy $win; break"
- bind $win <KeyRelease-Escape> "destroy $win; break"
+ -command "
+ ::X::cleanup_PROCEED
+ destroy $win
+ " \
+ ] -side left -padx 5
+ pack [ttk::button $but_frame.cancel_button \
+ -text [mc "Cancel"] \
+ -compound left \
+ -image ::ICONS::16::button_cancel \
+ -command [list destroy $win] \
+ ] -side left -padx 5
+ focus -force $but_frame.ok_button
+ pack $but_frame -side bottom -anchor e -pady 5 -pady 5
# Set window attributes -- modal window
wm iconphoto $win ::ICONS::16::emptytrash
@@ -7094,12 +7357,17 @@ namespace eval X {
-icon warning \
-type yesno \
-title [mc "Confirm termination - MCU 8051 IDE"] \
- -message [mc "This process is alredy in progress. Do you want to terminate it ?"]
+ -message [mc "This process is already in progress. Do you want to terminate it ?"]
] == {yes}} {
if {!$::MICROSOFT_WINDOWS} { ;# There is no kill command on Microsoft Windows
if {$custom_command_PID($cmd_num) != {}} {
- catch {
- exec -- kill -9 $custom_command_PID($cmd_num) &
+ foreach pid $custom_command_PID($cmd_num) {
+ if {$pid == [pid] || $pid == 0} {
+ continue
+ }
+ catch {
+ exec -- /bin/sh -c "kill -s 9 \$(ps -o pid --no-headers --ppid $pid)"
+ }
}
}
}
@@ -7112,13 +7380,14 @@ namespace eval X {
# Invoke confiramation dialog (if requested)
if {[lindex $custom_command_options($cmd_num) 0]} {
if {
- ![tk_messageBox \
- -parent . \
- -icon question \
- -type yesno \
+ [tk_messageBox \
+ -parent . \
+ -icon question \
+ -type yesno \
-title [mc "Confirmation required"] \
- -message [mc "Do you really want to execute\ncustom command %s ?" $cmd_num]]
- } {
+ -message [mc "Do you really want to execute\ncustom command %s ?" $cmd_num] \
+ ] != {yes}
+ } then {
set critical_procedure_in_progress 0
return
}
@@ -7137,20 +7406,22 @@ namespace eval X {
# Determinate editor object reference
set editor [$actualProject get_current_editor_object]
- if {[regexp {%URLS} $cmd]} {
- set URLS {}
+ regsub -all {%URL} $cmd {%URI} cmd
+
+ if {[regexp {%URIS} $cmd]} {
+ set URIS {}
foreach e [$actualProject cget -editors] {
set url [$e cget -fullFileName]
if {[regexp {\s} $url]} {
- append URLS "\"" $url "\"" { }
- } {
- append URLS $url { }
+ append URIS "\"" $url "\"" { }
+ } else {
+ append URIS $url { }
}
}
- regsub -all {%URLS} $cmd [string replace $URLS end end] cmd
+ regsub -all {%URIS} $cmd [string replace $URIS end end] cmd
}
- if {[regexp {%URL} $cmd]} {
- regsub -all {%URL} $cmd [$editor cget -fullFileName] cmd
+ if {[regexp {%URI} $cmd]} {
+ regsub -all {%URI} $cmd [$editor cget -fullFileName] cmd
}
if {[regexp {%directory} $cmd]} {
regsub -all {%directory} $cmd [$actualProject cget -projectPath] cmd
@@ -7178,7 +7449,7 @@ namespace eval X {
if {[regexp {%text} $cmd]} {
regsub -all {%text} $cmd [$editor getdata] cmd
}
- } {
+ } else {
if {[regsub -all {%(line|column|selection|text)} $cmd {} cmd]} {
tk_messageBox \
-parent . \
@@ -7191,12 +7462,19 @@ namespace eval X {
}
regsub -all "\a" $cmd {%} cmd
- # Execute specified command in a separate thread
+ ## Execute the specified command
set custom_command_NUM($cmd_num) $custom_command_counter
- set custom_command_PID($cmd_num) [exec -- tclsh \
- ${::LIB_DIRNAME}/custom_command.tcl [tk appname] \
- $custom_command_NUM($cmd_num) << $cmd & \
- ]
+ # Run in terminal
+ if {[lindex $custom_command_options($cmd_num) 3] && $::PROGRAM_AVAILABLE(urxvt)} {
+ exec_custom_cmd_in_terminal $cmd_num $cmd
+ custom_cmd_icon_reset $custom_command_NUM($cmd_num)
+ # Run normally
+ } else {
+ set custom_command_PID($cmd_num) [exec -- tclsh \
+ ${::LIB_DIRNAME}/custom_command.tcl [tk appname] \
+ $custom_command_NUM($cmd_num) << $cmd & \
+ ]
+ }
incr custom_command_counter
# Finalize
@@ -7215,7 +7493,7 @@ namespace eval X {
set i [custom_cmd_icon_reset $num]
if {$i == {}} {return}
- # Check if result dialogs are allowed
+ # Check if result dialogues are allowed
if {![lindex $custom_command_options($i) 1]} {return}
# Invoke results dialog
invoke_custom_cmd_dialog $i {#00DD00} [mc "Custom command finished"] $result
@@ -7233,12 +7511,107 @@ namespace eval X {
set i [custom_cmd_icon_reset $num]
if {$i == {}} {return}
- # Check if error dialogs are allowed
+ # Check if error dialogues are allowed
if {[lindex $custom_command_options($i) 2]} {return}
# Invoke error dialog
invoke_custom_cmd_dialog $i {#DD0000} [mc "Custom command failed"] $result
}
+ ## Execute custom command in terminal emulator
+ # @parm Int cmd_num - Number of the custom command to execute
+ # @parm String cmd - Command string to execute
+ # @return void
+ proc exec_custom_cmd_in_terminal {cmd_num cmd} {
+ variable custom_cmd_dialog_index ;# Index of results dialog (to keep win IDs unique)
+
+ incr custom_cmd_dialog_index
+
+ # Create dialog window
+ set win [toplevel .custom_cmd_dialog${custom_cmd_dialog_index} -class {Custom command running} -bg ${::COMMON_BG_COLOR}]
+
+ # Create dialog header
+ pack [label $win.header_label \
+ -compound left \
+ -text [mc "Custom command %s - MCU 8051 IDE" $cmd_num] \
+ -image ::ICONS::22::gear${cmd_num}_play \
+ -font [font create \
+ -family {helvetica} \
+ -size [expr {int(-20 * $::font_size_factor)}] \
+ -weight bold \
+ ] \
+ ] -pady 5
+
+ # Create main frame (text widget and scrollbar)
+ set main_frame [frame $win.main_frame -container 1]
+ bind $main_frame <Destroy> [list destroy $win]
+ pack $main_frame -fill both -expand 1 -padx 5 -pady 5
+
+ # Set window attributes
+ wm iconphoto $win ::ICONS::16::gear
+ wm title $win [mc "Custom command %s - MCU 8051 IDE" $cmd_num]
+ wm minsize $win 550 300
+ wm protocol $win WM_DELETE_WINDOW {}
+ update
+
+ # Run terminal emulator
+ if {[catch {
+ set terminal_pid [exec -- urxvt \
+ -embed [expr [winfo id $main_frame]] \
+ -hold -sr -b 0 -w 0 -bg ${::Terminal::configuration(bg)}\
+ -fg ${::Terminal::configuration(fg)} \
+ -fn "xft:${::Terminal::configuration(font_family)}:pixelsize=${::Terminal::configuration(font_size)}" \
+ -e bash -i -c $cmd \
+ & \
+ ]
+ } result]} then {
+ destroy $win
+ tk_messageBox \
+ -parent . \
+ -icon warning \
+ -type ok \
+ -title [mc "Unknow error"] \
+ -message [mc "Unable to execute your script in the urxvt terminal emulator."]
+ puts stderr $result
+ } else {
+ wm protocol $win WM_DELETE_WINDOW [list ::X::close_custom_cmd_term $terminal_pid $win]
+ }
+ }
+
+ ## Close terminal emulator with a custom command
+ # @parm Int pid - Terminal PID
+ # @parm Widget dialog - Dialog window in which the terminal is mapped
+ # @return void
+ proc close_custom_cmd_term {pid dialog} {
+ # Get list of child processes of the terminal
+ set children [list]
+ catch {
+ set children [exec -- /bin/sh -c "ps -o pid --no-headers --ppid $pid"]
+ }
+
+ # Ask user, if he/she wishes to kill the children, if there are any
+ if {
+ [llength $children]
+ &&
+ [tk_messageBox \
+ -parent $dialog \
+ -icon question \
+ -type yesno \
+ -title [mc "Kill the script?"] \
+ -message [mc "Closing this window terminates all child processes of the terminal.\n\nDo you want to proceed?"] \
+ ] != {yes}
+ } then {
+ return
+ }
+
+ # Kill the terminal
+ if {[catch {
+ exec -- kill $pid &
+ }]} then {
+ puts stderr "Something went wrong here..."
+ puts stderr $::errorInfo
+ }
+ }
+
## Invoke dialog window showing results of some custom command
# -- auxiliary procedure for 'custom_cmd_error' and 'custom_cmd_finish'
# @parm Int i - Index of the custom command (0..2)
@@ -7252,18 +7625,18 @@ namespace eval X {
incr custom_cmd_dialog_index
# Create dialog window
- set win [toplevel .custom_cmd_dialog${custom_cmd_dialog_index} -class {Custom command finished} -bg {#EEEEEE}]
+ set win [toplevel .custom_cmd_dialog${custom_cmd_dialog_index} -class {Custom command finished} -bg ${::COMMON_BG_COLOR}]
# Create dialog header
- pack [label $win.header_label \
- -compound left \
- -fg $color \
- -text $label \
- -image ::ICONS::22::gear$i \
- -font [font create \
- -family {helvetica} \
- -size -20 \
- -weight bold \
+ pack [label $win.header_label \
+ -compound left \
+ -fg $color \
+ -text $label \
+ -image ::ICONS::22::gear$i \
+ -font [font create \
+ -family {helvetica} \
+ -size [expr {int(-20 * $::font_size_factor)}] \
+ -weight bold \
] \
] -pady 5
@@ -7305,16 +7678,16 @@ namespace eval X {
wm transient $win .
}
- ## Set toolbar button icon to default and determinate index of cutom command
+ ## Set toolbar button icon to default and determinate index of custom command
# -- auxiliary procedure for 'custom_cmd_error' and 'custom_cmd_finish'
# @parm Int num - Command number
- # @return Int - index of the specified cutom command (by TID) or {} (means 'not found')
+ # @return Int - index of the specified custom command (by TID) or {} (means 'not found')
proc custom_cmd_icon_reset {num} {
variable custom_command_NUM ;# Array of custom command numbers
variable custom_command_PID ;# Array of custom command TIDs (Thread IDentifiers)
# Search for command index
- set found 0 ;# Bool: Coresponding index found
+ set found 0 ;# Bool: Corresponding index found
for {set i 0} {$i < 3} {incr i} {
if {[string equal $custom_command_NUM($i) $num]} {
set found 1
@@ -7344,46 +7717,71 @@ namespace eval X {
}
# Create dialog window
- set win [toplevel .welcome -class [mc "Welcome dialog"] -bg {#EEEEEE}]
+ set win [toplevel .welcome -class {Welcome dialog} -bg ${::COMMON_BG_COLOR}]
# Create header label
- pack [label $win.header_label \
- -compound left -fg {#0000DD} \
- -text [mc "Welcome to MCU 8051 IDE !"] \
- -font [font create \
- -family {helvetica} \
- -size -20 \
- -weight {bold} \
- -slant {italic} \
- ] \
+ pack [label $win.header_label \
+ -compound left -fg {#0000DD} \
+ -text [mc "Welcome to MCU 8051 IDE !"] \
+ -font [font create \
+ -family {helvetica} \
+ -size [expr {int(-20 * $::font_size_factor)}] \
+ -weight {bold} \
+ -slant {italic} \
+ ] \
] -pady 10
+ # Create frame for the text widget and its scrollbar
+ set text_frame [frame $win.text_frame]
+
# Create text widget showing the dialog message
- set text [text $win.text \
- -bg {#EEEEEE} -takefocus 0 \
- -width 0 -heigh 0 -bd 0 \
- -cursor left_ptr \
- -wrap word \
- -font [font create \
- -family {helvetica} \
- -size -12 \
- ] \
+ set text [text $text_frame.text \
+ -bg ${::COMMON_BG_COLOR} -takefocus 0 \
+ -width 0 -heigh 0 -bd 0 \
+ -cursor left_ptr \
+ -wrap word \
+ -yscrollcommand [list $text_frame.scrollbar set] \
+ -font [font create \
+ -family {helvetica} \
+ -size [expr {int(-12 * $::font_size_factor)}] \
+ ] \
+ ]
+
+ # Create scrollbar for the text widget
+ set scrollbar [ttk::scrollbar $text_frame.scrollbar \
+ -command [list $text yview] \
+ -orient vertical \
]
- pack $text -fill both -expand 1 -padx 15
+
+ # Pack scrollbar and the text widget
+ pack $text -side left -fill both -expand 1
+ pack $scrollbar -side right -fill y
+ pack $text_frame -fill both -expand 1 -padx 15
# Create button "Ok"
pack [ttk::button $win.ok_button \
-text [mc "Ok"] \
+ -compound left \
+ -image ::ICONS::16::ok \
-command "grab release $win; destroy $win" \
] -pady 5
# Create label for opening demostration project
set open_demo_label [label $text.open_demo_label \
-text [mc "Click here to open demonstration project."] \
- -justify left -fg {#00DD00} -cursor hand1 \
+ -justify left \
+ -fg {#0055FF} \
+ -cursor hand2 \
+ -font [font create \
+ -family {helvetica} \
+ -size [expr {int(-12 * $::font_size_factor)}] \
+ ] \
+ -image ::ICONS::16::2_rightarrow \
+ -compound left \
+ -padx 5 \
]
- bind $open_demo_label <Enter> {%W configure -fg {#0000DD}}
- bind $open_demo_label <Leave> {%W configure -fg {#00DD00}}
+ bind $open_demo_label <Enter> {%W configure -fg {#00DD00}}
+ bind $open_demo_label <Leave> {%W configure -fg {#0055FF}}
bind $open_demo_label <Button-1> "
grab release $win
destroy $win
@@ -7392,59 +7790,76 @@ namespace eval X {
"
# Load images
- set image_new [image create photo -format png \
- -file "${::LIB_DIRNAME}/../icons/16x16/filenew.png"]
- set image_start [image create photo -format png \
- -file "${::LIB_DIRNAME}/../icons/16x16/launch.png"]
- set image_step [image create photo -format png \
- -file "${::LIB_DIRNAME}/../icons/16x16/goto.png"]
+ set image_new ::ICONS::16::filenew
+ set image_start ::ICONS::16::launch
+ set image_step ::ICONS::16::goto
+ set image_list0 ::ICONS::16::dot_r
+ set image_list1 ::ICONS::16::dot_g
+ set image_list2 ::ICONS::16::dot
# Create text tags
- $text tag configure bold -font [font create \
- -family {times} \
- -size -12 \
- -weight bold \
+ $text tag configure bold -font [font create \
+ -family {helvetica} \
+ -size [expr {int(-12 * $::font_size_factor)}] \
+ -weight bold \
]
- $text tag configure header -font [font create \
- -family {times} \
- -size -12 \
- -weight bold \
- -underline 1 \
- ] -foreground {#0000FF}
+ $text tag configure header -font [font create \
+ -family {helvetica} \
+ -size [expr {int(-12 * $::font_size_factor)}] \
+ -weight bold \
+ -underline 1 \
+ ] -foreground {#0000DD}
# Fill in the text widget
- $text insert end [mc "MCU 8051 IDE is fully featured Integrated Development Enviroment"]
- $text insert end [mc " for MCS-51 based microcontollers. It's written for POSIX Operating Systems (GNU/Linux, etc.) "]
+ $text insert end [mc "MCU 8051 IDE is a fully featured Integrated Development Environment"]
+ $text insert end [mc " for MCS-51 based microcontrollers. It's written for POSIX Operating Systems (GNU/Linux, etc.) "]
if {$::MICROSOFT_WINDOWS} {
$text insert end [mc "and since version 1.3.5 it is also available for Microsoft® Windows® operating system."]
}
$text insert end "\n\n"
$text insert end [mc "Main features:"]
$text tag add header {insert linestart} insert
- $text insert end [mc "\n\t- Editor with syntax highlight, validation and popup-based completion"]
- $text insert end [mc "\n\t- MCS-51 Assembler and Disassembler"]
- $text insert end [mc "\n\t- MCS-51 Simulator (not all MCUs are fully supported !)"]
- $text insert end [mc "\n\t- Support for C language (using C compiler SDCC)"]
- $text insert end [mc "\n\t- Partial support for some HW tools"]
- $text insert end [mc "\n\t- Project management"]
- $text insert end [mc "\n\t- Custom editable commands (using shell scripts)"]
- $text insert end [mc "\n\t- Dynamic help for instruction at the current line"]
- $text insert end [mc "\n\t- Hexadecimal editor for eXternal RAM, Expanded RAM, Code memory, etc."]
- $text insert end [mc "\n\t- Scientific calculator"]
- $text insert end [mc "\n\t- Simple hardware simulation (LED's, etc.)"]
- $text insert end [mc "\n\t- Graph showing voltage levels on ports\n\n"]
+ $text insert end "\n\t"
+ $text image create end -image $image_list1 -padx 5
+ $text insert end [mc "Editor with syntax highlight, validation and popup-based completion\n\t"]
+ $text image create end -image $image_list1 -padx 5
+ $text insert end [mc "MCS-51 Assembler and Disassembler\n\t"]
+ $text image create end -image $image_list1 -padx 5
+ $text insert end [mc "MCS-51 Simulator (not all MCUs are fully supported!)\n\t"]
+ $text image create end -image $image_list1 -padx 5
+ $text insert end [mc "Support for C language (using C compiler SDCC)\n\t"]
+ $text image create end -image $image_list1 -padx 5
+ $text insert end [mc "Partial support for some HW tools\n\t"]
+ $text image create end -image $image_list1 -padx 5
+ $text insert end [mc "Project management\n\t"]
+ $text image create end -image $image_list1 -padx 5
+ $text insert end [mc "Custom editable commands (using shell scripts)\n\t"]
+ $text image create end -image $image_list1 -padx 5
+ $text insert end [mc "Dynamic help for instruction at the current line\n\t"]
+ $text image create end -image $image_list1 -padx 5
+ $text insert end [mc "Hexadecimal editor for eXternal RAM, Expanded RAM, Code memory, etc.\n\t"]
+ $text image create end -image $image_list1 -padx 5
+ $text insert end [mc "Scientific calculator\n\t"]
+ $text image create end -image $image_list1 -padx 5
+ $text insert end [mc "Simple hardware simulation (LED's, etc.)\n\t"]
+ $text image create end -image $image_list1 -padx 5
+ $text insert end [mc "Graph showing voltage levels on ports\n\n"]
$text insert end [mc "Where to start:"]
$text tag add header {insert linestart} insert
$text insert end [mc "\n\t1. Create a new project"]
$text image create end -image $image_new -padx 5
- $text insert end [mc "\n\t\t- Enter project name\n"]
- $text insert end [mc "\t\t- Choose project directory\n"]
- $text insert end [mc "\t\t- Choose microcontroller (e.g. AT89S52)\n"]
+ $text insert end "\n\t\t"
+ $text image create end -image $image_list1 -padx 5
+ $text insert end [mc "Enter project name\n\t\t"]
+ $text image create end -image $image_list1 -padx 5
+ $text insert end [mc "Choose project directory\n\t\t"]
+ $text image create end -image $image_list1 -padx 5
+ $text insert end [mc "Choose microcontroller (e.g. AT89S52)\n"]
$text insert end [mc "\t2. Write your code in the opened editor and click on "]
$text image create end -image $image_start -padx 5
- $text insert end [mc " to start simulator\n"]
- $text insert end [mc "\t3. Step your program by clicking on "]
+ $text insert end [mc " to start the simulator\n"]
+ $text insert end [mc "\t3. Step through your program by clicking on "]
$text image create end -image $image_step -padx 5
$text insert end "\n\t----\n\t"
$text window create end -window $open_demo_label
@@ -7454,19 +7869,21 @@ namespace eval X {
$text insert end [mc "Web site:"]
$text tag add bold {insert linestart} insert
$text insert end "\thttp://mcu8051ide.sourceforge.net\n"
- $text insert end [mc "Author:"]
+ $text insert end [mc "Authors:"]
$text tag add bold {insert linestart} insert
- $text insert end "\tMartin Ošmera <martin.osmera@gmail.com>\n\n"
+ $text insert end "\tMartin Ošmera <martin.osmera@gmail.com>\n"
$text insert end [mc "Thank you for using/trying MCU 8051 IDE."]
$text tag add bold {insert linestart} insert
+ create_link_tag_in_text_widget $text
+ convert_all_https_to_links $text
$text configure -state disabled
# Set window attributes
wm iconphoto $win ::ICONS::16::info
wm title $win [mc "Welcome to MCU 8051 IDE"]
- wm minsize $win 580 600
+ wm minsize $win 580 400
wm protocol $win WM_DELETE_WINDOW "grab release $win; destroy $win"
wm transient $win .
catch {grab $win}
@@ -7476,7 +7893,12 @@ namespace eval X {
## Open demostration project -- auxiliary procedure for '__welcome_dialog'
# @return void
proc open_demo_project {} {
- Project::open_project_file "${::LIB_DIRNAME}/../demo/Demo project.mcu8051ide"
+ variable openedProjects ;# List of opened projects (Object references)
+
+ if {[Project::open_project_file "${::INSTALLATION_DIR}/demo/Demo project.mcu8051ide"]} {
+ # The demostration project is for reading only, it cannot be saved
+ [lindex $openedProjects end] set_read_only
+ }
}
## Invoke dialog "Change letter case"
@@ -7492,15 +7914,15 @@ namespace eval X {
if {$critical_procedure_in_progress} {return}
# Create dialog window
- set win [toplevel .change_letter_case -class [mc "Options dialog"] -bg {#EEEEEE}]
+ set win [toplevel .change_letter_case -class [mc "Options dialog"] -bg ${::COMMON_BG_COLOR}]
# Create dialog header
- pack [label $win.header \
- -compound left \
- -image ::ICONS::22::change_case \
- -text [mc "Change letter case"] \
- -font [font create \
- -size -20 \
+ pack [label $win.header \
+ -compound left \
+ -image ::ICONS::22::change_case \
+ -text [mc "Change letter case"] \
+ -font [font create \
+ -size [expr {int(-20 * $::font_size_factor)}] \
-family {times}]
] -side top -pady 5
@@ -7529,15 +7951,16 @@ namespace eval X {
{Hexadecimal number} {Octal number}
{Decimal number} {Binary number}
{Constant} {Generic number}
- {Comment} {Control sequentce}
+ {Comment} {Control sequence}
{Symbol} {Directive}
{Label} {Instruction}
- {SFR register} {Indirect adress}
+ {SFR register} {Indirect address}
{Immediate hex} {Immediate oct}
{Immediate dec} {Immediate bin}
{Immediate const} {Immediate generic}
{Macro instruction}
- } {
+ } \
+ {
# Create label
grid [label $main_frame.label$i \
-text [mc $text] -justify left \
@@ -7547,17 +7970,17 @@ namespace eval X {
# Radiobutton "Uppercase"
grid [radiobutton $main_frame.upper$i \
- -value [mc "U"] -highlightthickness 0 -pady 0 \
+ -value {U} -highlightthickness 0 -pady 0 \
-variable ::X::change_letter_case_options($i) \
] -row $row -column [expr {$col * 4 + 1}] -sticky w
# Radiobutton "Lowercase"
grid [radiobutton $main_frame.lower$i \
- -value [mc "L"] -highlightthickness 0 -pady 0 \
+ -value {L} -highlightthickness 0 -pady 0 \
-variable ::X::change_letter_case_options($i) \
] -row $row -column [expr {$col * 4 + 2}] -sticky w
# Radiobutton "Keep"
grid [radiobutton $main_frame.keep$i \
- -value [mc "-"] -highlightthickness 0 -pady 0 \
+ -value {-} -highlightthickness 0 -pady 0 \
-variable ::X::change_letter_case_options($i) \
] -row $row -column [expr {$col * 4 + 3}] -sticky w
@@ -7585,7 +8008,7 @@ namespace eval X {
-text [mc "All "] \
-image ::ICONS::16::$image \
-command "::X::change_letter_case_all_to $state" \
- ] -side left
+ ] -side left -padx 2
}
# Create and pack buttons "OK" and "CANCEL"
pack [ttk::button $button_frame.ok_button \
@@ -7593,13 +8016,13 @@ namespace eval X {
-compound left \
-image ::ICONS::16::ok \
-command {X::change_letter_case_OK} \
- ] -side right
+ ] -side right -padx 2
pack [ttk::button $button_frame.cancel_button \
-text [mc "Cancel"] \
-compound left \
-image ::ICONS::16::button_cancel \
-command {X::change_letter_case_CANCEL} \
- ] -side right
+ ] -side right -padx 2
# Events binding (Enter == Ok; Escape == Cancel)
bind $win <KeyRelease-Return> {::X::change_letter_case_OK; break}
@@ -7608,7 +8031,7 @@ namespace eval X {
# Pack frames
pack $main_frame -fill both -expand 1 -padx 10 -pady 10
- pack $button_frame -side bottom -fill x
+ pack $button_frame -side bottom -fill x -padx 5 -pady 5
# Set window attributes
wm iconphoto $win ::ICONS::16::change_case
@@ -7665,11 +8088,12 @@ namespace eval X {
[$actualProject editor_procedure {} getLinesCount {}] == 1
&&
[$actualProject editor_procedure {} getLineContent 1] == {}
- } {
+ } then {
tk_messageBox \
+ -parent . \
-type ok \
-icon error \
- -title [mc "Unable to compile"] \
+ -title [mc "Unable to comply"] \
-message [mc "This editor seems to be empty"]
return
}
@@ -7681,7 +8105,7 @@ namespace eval X {
incr max
# Create progress dialog window
- set win [toplevel .change_letter_case_dialog -class {Progress dialog} -bg {#EEEEEE}]
+ set win [toplevel .change_letter_case_dialog -class {Progress dialog} -bg ${::COMMON_BG_COLOR}]
# Create label and progress bar
set main_frame [frame $win.main_frame]
@@ -7722,11 +8146,11 @@ namespace eval X {
$actualProject editor_procedure {} highlight_all {}
if {![winfo exists $win]} {return}
- # Determinate maximum value for the 2nd progress bar ("Formating")
+ # Determinate maximum value for the 2nd progress bar ("Formatting")
set max [$actualProject editor_procedure {} change_letter_case_get_count_of_iterations "{$options}"]
incr max
# Change progress bar header label
- $main_frame.header configure -text [mc "Formating ..."]
+ $main_frame.header configure -text [mc "Formatting ..."]
$main_frame.progress_bar configure -maximum $max
set compilation_progress 1 ;# Reset compilation progress variable
@@ -7833,7 +8257,10 @@ namespace eval X {
variable project_menu_locked ;# Bool: Indicates than there is at least one opened project
if {$project_menu_locked} {return}
- $actualProject switch_editor_RO_MODE
+ if {![$actualProject switch_editor_RO_MODE]} {
+ # Switch the flag back if the operation was unsuccessful
+ set ::editor_RO_MODE [expr {!$::editor_RO_MODE}]
+ }
}
## Prepare window "Project details"
@@ -7852,7 +8279,7 @@ namespace eval X {
if {$projectdetails_last_project == $project} {
project_details_move
return
- } {
+ } else {
set projectdetails_last_project $project
}
@@ -7869,7 +8296,6 @@ namespace eval X {
# Create window
set PROJECTDETAILSWIN [frame .project_details_win -bg {#BBBBFF}]
set project_details_win [frame $PROJECTDETAILSWIN.frm -bg {#FFFFFF}]
- bind $PROJECTDETAILSWIN <Button-1> "catch {destroy $PROJECTDETAILSWIN}"
# Create header
pack [label $project_details_win.header \
@@ -7893,13 +8319,17 @@ namespace eval X {
-anchor w -pady 0 -bg {#FFFFFF} \
] -row 0 -column 1 -sticky w -pady 0
# Path
- grid [label $main_frame.path_label \
- -text [mc "Path:"] -fg {#880033} \
- -anchor w -pady 0 -bg {#FFFFFF} \
+ grid [label $main_frame.path_label \
+ -text [mc "Path:"] -fg {#880033}\
+ -anchor w -pady 0 -bg {#FFFFFF} \
] -row 1 -column 0 -sticky w -pady 0
- grid [label $main_frame.path_value \
- -text [$project cget -projectPath] \
- -anchor w -pady 0 -bg {#FFFFFF} \
+ set path [$project cget -projectPath]
+ if {$::MICROSOFT_WINDOWS} {
+ regsub -all {/} $path "\\" path
+ }
+ grid [label $main_frame.path_value \
+ -text $path \
+ -anchor w -pady 0 -bg {#FFFFFF} \
] -row 1 -column 1 -sticky w -pady 0
# Separator
@@ -7943,10 +8373,10 @@ namespace eval X {
-anchor w -pady 0 -bg {#FFFFFF} \
] -row 6 -column 1 -sticky w -pady 0
- set more_details_avaliable 0
+ set more_details_available 0
# Version
if {[string length [$project cget -P_information_version]]} {
- set more_details_avaliable 1
+ set more_details_available 1
grid [label $main_frame.ver_label \
-text [mc "Version:"] -fg {#0000AA} \
-anchor w -pady 0 -bg {#FFFFFF} \
@@ -7958,7 +8388,7 @@ namespace eval X {
}
# Date
if {[string length [$project cget -P_information_date]]} {
- set more_details_avaliable 1
+ set more_details_available 1
grid [label $main_frame.date_label \
-text [mc "Date:"] -fg {#0000AA} \
-anchor w -pady 0 -bg {#FFFFFF} \
@@ -7968,22 +8398,22 @@ namespace eval X {
-text [$project cget -P_information_date] \
] -row 9 -column 1 -sticky w -pady 0
}
- # Licence
- if {[string length [$project cget -G_information_licence]]} {
- set more_details_avaliable 1
- grid [label $main_frame.licence_label \
- -text [mc "Licence:"] \
+ # License
+ if {[string length [$project cget -G_information_license]]} {
+ set more_details_available 1
+ grid [label $main_frame.license_label \
+ -text [mc "License:"] \
-fg {#0000AA} \
-anchor w -pady 0 -bg {#FFFFFF} \
] -row 10 -column 0 -sticky w -pady 0
- grid [label $main_frame.licence_value \
- -text [$project cget -G_information_licence] \
+ grid [label $main_frame.license_value \
+ -text [$project cget -G_information_license] \
-anchor w -pady 0 -bg {#FFFFFF} \
] -row 10 -column 1 -sticky w -pady 0
}
# Copyright
if {[string length [$project cget -G_information_copyright]]} {
- set more_details_avaliable 1
+ set more_details_available 1
grid [label $main_frame.copyright_label \
-text [mc "Copyright:"] \
-fg {#0000AA} -bg {#FFFFFF} \
@@ -7996,7 +8426,7 @@ namespace eval X {
}
# Authors
if {[string length $authors]} {
- set more_details_avaliable 1
+ set more_details_available 1
grid [label $main_frame.authors_label \
-text [mc "Authors:"] \
-fg {#0000AA} \
@@ -8008,7 +8438,7 @@ namespace eval X {
] -row 12 -column 1 -sticky w -pady 0
}
# Separator
- if {$more_details_avaliable} {
+ if {$more_details_available} {
grid [ttk::separator $main_frame.sep1 -orient horizontal \
] -row 7 -column 0 -columnspan 2 -sticky we -pady 5
}
@@ -8018,6 +8448,11 @@ namespace eval X {
pack $main_frame -fill both -expand 1 -padx 8 -pady 3
pack $project_details_win -fill both -expand 1 -padx 2 -pady 2
+ # Configure the window in a way that it will close when the user clicks on it
+ foreach w [concat $project_details_win [pack slaves $project_details_win] [grid slaves $main_frame]] {
+ bind $w <Button-1> {::X::close_project_details}
+ }
+
# Show window "Project details"
project_details_move
}
@@ -8041,7 +8476,6 @@ namespace eval X {
# @return void
proc close_project_details args {
variable PROJECTDETAILSWIN ;# ID of project details window
- variable projectdetails_last_project ;# Project object of the last project details window
# Hide the window
catch {place forget $PROJECTDETAILSWIN}
@@ -8063,18 +8497,18 @@ namespace eval X {
}
# Enable/Disable menu entries
- set tabindex [.mainFrame.mainNB index $project]
+ set tabindex [${::main_nb} index $project]
if {!$tabindex} {
$projectmenu entryconfigure [::mc "Move to beginning"] -state disabled
$projectmenu entryconfigure [::mc "Move left"] -state disabled
- } {
+ } else {
$projectmenu entryconfigure [::mc "Move to beginning"] -state normal
$projectmenu entryconfigure [::mc "Move left"] -state normal
}
- if {$tabindex == ([llength [.mainFrame.mainNB pages]] - 1)} {
+ if {$tabindex == ([llength [${::main_nb} pages]] - 1)} {
$projectmenu entryconfigure [::mc "Move right"] -state disabled
$projectmenu entryconfigure [::mc "Move to end"] -state disabled
- } {
+ } else {
$projectmenu entryconfigure [::mc "Move right"] -state normal
$projectmenu entryconfigure [::mc "Move to end"] -state normal
}
@@ -8140,7 +8574,7 @@ namespace eval X {
set actualProjectIdx [lsearch -exact -ascii $openedProjects $actualProject]
if {$actualProjectIdx == $tmp_idx} {
set this_closed 1
- } {
+ } else {
set this_closed 0
}
@@ -8164,7 +8598,7 @@ namespace eval X {
set actualProjectIdx [lsearch -exact -ascii $openedProjects $actualProject]
if {$actualProjectIdx == $tmp_idx} {
set this_closed 1
- } {
+ } else {
set this_closed 0
}
@@ -8184,13 +8618,13 @@ namespace eval X {
proc __project_move_to_left {} {
variable projectmenu_project ;# Object: project selected by project popup menu
- set index [.mainFrame.mainNB index $projectmenu_project]
+ set index [${::main_nb} index $projectmenu_project]
if {!$index} {
return
}
incr index -1
- .mainFrame.mainNB move $projectmenu_project $index
+ ${::main_nb} move $projectmenu_project $index
}
## Function for project popup menu
@@ -8199,13 +8633,13 @@ namespace eval X {
proc __project_move_to_right {} {
variable projectmenu_project ;# Object: project selected by project popup menu
- set index [.mainFrame.mainNB index $projectmenu_project]
- if {$index == ([llength [.mainFrame.mainNB index pages]] - 1)} {
+ set index [${::main_nb} index $projectmenu_project]
+ if {$index == ([llength [${::main_nb} index pages]] - 1)} {
return
}
incr index
- .mainFrame.mainNB move $projectmenu_project $index
+ ${::main_nb} move $projectmenu_project $index
}
## Function for project popup menu
@@ -8214,10 +8648,10 @@ namespace eval X {
proc __project_move_to_beginning {} {
variable projectmenu_project ;# Object: project selected by project popup menu
- if {![.mainFrame.mainNB index $projectmenu_project]} {
+ if {![${::main_nb} index $projectmenu_project]} {
return
}
- .mainFrame.mainNB move $projectmenu_project 0
+ ${::main_nb} move $projectmenu_project 0
}
## Function for project popup menu
@@ -8226,12 +8660,12 @@ namespace eval X {
proc __project_move_to_end {} {
variable projectmenu_project ;# Object: project selected by project popup menu
- set end [expr {[llength [.mainFrame.mainNB pages]] - 1}]
- if {[.mainFrame.mainNB index $projectmenu_project] == $end} {
+ set end [expr {[llength [${::main_nb} pages]] - 1}]
+ if {[${::main_nb} index $projectmenu_project] == $end} {
return
}
- .mainFrame.mainNB move $projectmenu_project $end
+ ${::main_nb} move $projectmenu_project $end
}
## Invert flag "allow breakpoints"
@@ -8240,7 +8674,7 @@ namespace eval X {
set ::CONFIG(BREAKPOINTS_ALLOWED) [expr {!$::CONFIG(BREAKPOINTS_ALLOWED)}]
}
- ## Refresh bookmarks in filesystem browser in all projects
+ ## Refresh bookmarks in file system browser in all projects
# @return void
proc refresh_bookmarks_in_fs_browsers {} {
variable openedProjects ;# List of opened projects (Object references)
@@ -8261,16 +8695,16 @@ namespace eval X {
# @parm Int new_PC - New value of PC (-1 after reset)
# @return void
proc program_counter_changed {project new_PC} {
- variable opended_code_mem_windows ;# List of project object with opened CODE memory hex editor
+ variable opened_code_mem_windows ;# List of project object with opened CODE memory hex editor
variable code_mem_window_objects ;# List of CODE memory hex editor objects
- set idx [lsearch -exact -ascii $opended_code_mem_windows [string trimleft $project {:}]]
+ set idx [lsearch -exact -ascii $opened_code_mem_windows [string trimleft $project {:}]]
if {$idx != -1} {
set opcode [$project getCode $new_PC]
- if {[lsearch ${CompilerConsts::defined_OPCODE} $opcode] == -1} {
+ if {[lsearch ${::CompilerConsts::defined_OPCODE} $opcode] == -1} {
set ins_length 1
- } {
- set ins_length [lindex $CompilerConsts::Opcode($opcode) 2]
+ } else {
+ set ins_length [lindex $::CompilerConsts::Opcode($opcode) 2]
}
[lindex $code_mem_window_objects $idx] move_program_pointer $new_PC $ins_length
}
@@ -8281,19 +8715,19 @@ namespace eval X {
# @parm Int new_PC - New value of PC (-1 after reset)
# @return void
proc code_hex_editor_directly_move_program_pointer {project new_PC} {
- variable opended_code_mem_windows ;# List of project object with opened CODE memory hex editor
+ variable opened_code_mem_windows ;# List of project object with opened CODE memory hex editor
variable code_mem_window_objects ;# List of CODE memory hex editor objects
- set idx [lsearch -exact -ascii $opended_code_mem_windows [string trimleft $project {:}]]
+ set idx [lsearch -exact -ascii $opened_code_mem_windows [string trimleft $project {:}]]
if {$idx != -1} {
if {$new_PC != -1} {
set opcode [$project getCode $new_PC]
- if {[lsearch ${CompilerConsts::defined_OPCODE} $opcode] == -1} {
+ if {[lsearch ${::CompilerConsts::defined_OPCODE} $opcode] == -1} {
set ins_length 1
- } {
- set ins_length [lindex $CompilerConsts::Opcode($opcode) 2]
+ } else {
+ set ins_length [lindex $::CompilerConsts::Opcode($opcode) 2]
}
- } {
+ } else {
set ins_length 0
}
[lindex $code_mem_window_objects $idx] move_program_pointer_directly $new_PC $ins_length
@@ -8304,10 +8738,10 @@ namespace eval X {
# @parm Object project - Project object
# @return void
proc refresh_code_mem_window {project} {
- variable opended_code_mem_windows ;# List of project object with opened CODE memory hex editor
+ variable opened_code_mem_windows ;# List of project object with opened CODE memory hex editor
variable code_mem_window_objects ;# List of CODE memory hex editor objects
- set idx [lsearch -exact -ascii $opended_code_mem_windows [string trimleft $project {:}]]
+ set idx [lsearch -exact -ascii $opened_code_mem_windows [string trimleft $project {:}]]
if {$idx != -1} {
[lindex $code_mem_window_objects $idx] refresh
}
@@ -8317,10 +8751,10 @@ namespace eval X {
# @parm Object project - Project object
# @return void
proc refresh_xram_mem_window {project} {
- variable opended_xdata_mem_windows ;# List of project object with opened XDATA memory hex editor
+ variable opened_xdata_mem_windows ;# List of project object with opened XDATA memory hex editor
variable xdata_mem_window_objects ;# List of XDATA memory hex editor objects
- set idx [lsearch -exact -ascii $opended_xdata_mem_windows [string trimleft $project {:}]]
+ set idx [lsearch -exact -ascii $opened_xdata_mem_windows [string trimleft $project {:}]]
if {$idx != -1} {
[lindex $xdata_mem_window_objects $idx] refresh
}
@@ -8330,10 +8764,10 @@ namespace eval X {
# @parm Object project - Project object
# @return void
proc refresh_eram_mem_window {project} {
- variable opended_eram_windows ;# List of project object with opened ERAM hex editor
+ variable opened_eram_windows ;# List of project object with opened ERAM hex editor
variable eram_window_objects ;# List of ERAM hex editor objects
- set idx [lsearch -exact -ascii $opended_eram_windows [string trimleft $project {:}]]
+ set idx [lsearch -exact -ascii $opened_eram_windows [string trimleft $project {:}]]
if {$idx != -1} {
[lindex $eram_window_objects $idx] refresh
}
@@ -8343,24 +8777,24 @@ namespace eval X {
# @parm Object project - Project object
# @return void
proc refresh_eeprom_mem_window {project} {
- variable opended_eeprom_mem_windows ;# List of project object with opened ERAM hex editor
+ variable opened_eeprom_mem_windows ;# List of project object with opened ERAM hex editor
variable eeprom_mem_window_objects ;# List of ERAM hex editor objects
- set idx [lsearch -exact -ascii $opended_eeprom_mem_windows [string trimleft $project {:}]]
+ set idx [lsearch -exact -ascii $opened_eeprom_mem_windows [string trimleft $project {:}]]
if {$idx != -1} {
[lindex $eeprom_mem_window_objects $idx] refresh
}
}
- ## Clear background highlight for certain cell in hexeditor of data EEPROM
+ ## Clear background highlight for certain cell in hex editor of data EEPROM
# @parm Int addr - Register address (absolute)
# @parm Object project - Project object
# @return void
proc sync_eeprom_clear_bg_hg {addr project} {
- variable opended_eeprom_mem_windows ;# List of project object with opened data EEPROM hex editor
+ variable opened_eeprom_mem_windows ;# List of project object with opened data EEPROM hex editor
variable eeprom_mem_window_objects ;# List of data EEPROM hex editor objects
- set idx [lsearch -exact -ascii $opended_eeprom_mem_windows [string trimleft $project {:}]]
+ set idx [lsearch -exact -ascii $opened_eeprom_mem_windows [string trimleft $project {:}]]
if {$idx != -1} {
[lindex $eeprom_mem_window_objects $idx] set_bg_hg_clr $addr 0
}
@@ -8374,10 +8808,10 @@ namespace eval X {
# @parm Object project - Project object
# @return void
proc sync_eeprom_mem_window {addr hg project} {
- variable opended_eeprom_mem_windows ;# List of project object with opened data EEPROM hex editor
+ variable opened_eeprom_mem_windows ;# List of project object with opened data EEPROM hex editor
variable eeprom_mem_window_objects ;# List of data EEPROM hex editor objects
- set idx [lsearch -exact -ascii $opended_eeprom_mem_windows [string trimleft $project {:}]]
+ set idx [lsearch -exact -ascii $opened_eeprom_mem_windows [string trimleft $project {:}]]
if {$idx != -1} {
set obj [lindex $eeprom_mem_window_objects $idx]
$obj reg_sync $addr
@@ -8392,20 +8826,20 @@ namespace eval X {
# @parm Object project - Project object
# @return void
proc sync_xram_mem_window {addr project} {
- variable opended_xdata_mem_windows ;# List of project object with opened XDATA memory hex editor
+ variable opened_xdata_mem_windows ;# List of project object with opened XDATA memory hex editor
variable xdata_mem_window_objects ;# List of XDATA memory hex editor objects
- variable opended_eram_windows ;# List of project object with opened ERAM hex editor
+ variable opened_eram_windows ;# List of project object with opened ERAM hex editor
variable eram_window_objects ;# List of ERAM hex editor objects
set project [string trimleft $project {:}]
# Syncronize XDATA
- set idx [lsearch -exact -ascii $opended_xdata_mem_windows $project]
+ set idx [lsearch -exact -ascii $opened_xdata_mem_windows $project]
if {$idx != -1} {
[lindex $xdata_mem_window_objects $idx] reg_sync $addr
}
# Syncronize ERAM
- set idx [lsearch -exact -ascii $opended_eram_windows $project]
+ set idx [lsearch -exact -ascii $opened_eram_windows $project]
if {$idx != -1} {
[lindex $eram_window_objects $idx] reg_sync $addr
}
@@ -8435,7 +8869,7 @@ namespace eval X {
show_X_memory eeprom
}
- ## Invoke hexeditor dialog
+ ## Invoke hex editor dialog
# @see __show_exp_mem, __show_ext_mem, __show_code_mem, __show_eeprom
# @parm String type - memory type (one of {eeprom xdata code eram})
# @return void
@@ -8446,13 +8880,13 @@ namespace eval X {
variable actualProjectIdx ;# Index of the current project in $openedProjects
variable simulator_enabled ;# List of booleans: Simulator engaged
- variable opended_xdata_mem_windows ;# List of project object with opened XDATA memory hex editor
+ variable opened_xdata_mem_windows ;# List of project object with opened XDATA memory hex editor
variable xdata_mem_window_objects ;# List of XDATA memory hex editor objects
- variable opended_code_mem_windows ;# List of project object with opened CODE memory hex editor
+ variable opened_code_mem_windows ;# List of project object with opened CODE memory hex editor
variable code_mem_window_objects ;# List of CODE memory hex editor objects
- variable opended_eram_windows ;# List of project object with opened ERAM hex editor
+ variable opened_eram_windows ;# List of project object with opened ERAM hex editor
variable eram_window_objects ;# List of ERAM hex editor objects
- variable opended_eeprom_mem_windows ;# List of project object with opened data EEPROM hex editor
+ variable opened_eeprom_mem_windows ;# List of project object with opened data EEPROM hex editor
variable eeprom_mem_window_objects ;# List of data EEPROM hex editor objects
if {$project_menu_locked} {return}
@@ -8463,29 +8897,29 @@ namespace eval X {
if {![$actualProject cget -P_option_mcu_xdata]} {
return
}
- set idx [lsearch -exact -ascii $opended_xdata_mem_windows $actualProject]
- set list_of_opened {opended_xdata_mem_windows}
+ set idx [lsearch -exact -ascii $opened_xdata_mem_windows $actualProject]
+ set list_of_opened {opened_xdata_mem_windows}
set window_objects {xdata_mem_window_objects}
}
{eram} {
if {![lindex [$actualProject cget -procData] 8]} {
return
}
- set idx [lsearch -exact -ascii $opended_eram_windows $actualProject]
- set list_of_opened {opended_eram_windows}
+ set idx [lsearch -exact -ascii $opened_eram_windows $actualProject]
+ set list_of_opened {opened_eram_windows}
set window_objects {eram_window_objects}
}
{code} {
- set idx [lsearch -exact -ascii $opended_code_mem_windows $actualProject]
- set list_of_opened {opended_code_mem_windows}
+ set idx [lsearch -exact -ascii $opened_code_mem_windows $actualProject]
+ set list_of_opened {opened_code_mem_windows}
set window_objects {code_mem_window_objects}
}
{eeprom} {
if {![lindex [$actualProject cget -procData] 32]} {
return
}
- set idx [lsearch -exact -ascii $opended_eeprom_mem_windows $actualProject]
- set list_of_opened {opended_eeprom_mem_windows}
+ set idx [lsearch -exact -ascii $opened_eeprom_mem_windows $actualProject]
+ set list_of_opened {opened_eeprom_mem_windows}
set window_objects {eeprom_mem_window_objects}
}
}
@@ -8500,7 +8934,7 @@ namespace eval X {
set critical_procedure_in_progress 0
return
# Show
- } {
+ } else {
set object "hexedit_${type}_${actualProject}"
HexEditDlg ::$object $actualProject $type
lappend $list_of_opened $actualProject
@@ -8522,7 +8956,7 @@ namespace eval X {
set filename [file rootname $filename]
if {$ext == {.c} || $ext == {.h} || $ext == {.cxx} || $ext == {.cpp} || $ext == {.cc}} {
append filename {.ihx}
- } {
+ } else {
append filename {.hex}
}
@@ -8549,11 +8983,11 @@ namespace eval X {
proc sync_eeprom_write_buffer {addr project} {
variable actualProject ;# Object: Current project
variable project_menu_locked ;# Bool: Indicates than there is at least one opened project
- variable opended_eeprom_wr_bf_windows ;# List of project objects with opened data EEPROM write buffer editor
+ variable opened_eeprom_wr_bf_windows ;# List of project objects with opened data EEPROM write buffer editor
variable eeprom_wr_bf_window_objects ;# List of data EEPROM write buffer hex editor objects
if {$project_menu_locked} {return}
- set idx [lsearch -exact -ascii $opended_eeprom_wr_bf_windows [string trimleft $project {:}]]
+ set idx [lsearch -exact -ascii $opened_eeprom_wr_bf_windows [string trimleft $project {:}]]
if {$idx == -1} {return}
[string replace [lindex $eeprom_wr_bf_window_objects $idx] 0 0] \
setValue $addr [$project getEepromWrBufDEC $addr]
@@ -8565,11 +8999,11 @@ namespace eval X {
proc clear_eeprom_write_buffer {project} {
variable actualProject ;# Object: Current project
variable project_menu_locked ;# Bool: Indicates than there is at least one opened project
- variable opended_eeprom_wr_bf_windows ;# List of project objects with opened data EEPROM write buffer editor
+ variable opened_eeprom_wr_bf_windows ;# List of project objects with opened data EEPROM write buffer editor
variable eeprom_wr_bf_window_objects ;# List of data EEPROM write buffer hex editor objects
if {$project_menu_locked} {return}
- set idx [lsearch -exact -ascii $opended_eeprom_wr_bf_windows [string trimleft $project {:}]]
+ set idx [lsearch -exact -ascii $opened_eeprom_wr_bf_windows [string trimleft $project {:}]]
if {$idx == -1} {return}
set hexeditor [string replace [lindex $eeprom_wr_bf_window_objects $idx] 0 0]
for {set addr 0} {$addr < 32} {incr addr} {
@@ -8584,11 +9018,11 @@ namespace eval X {
proc eeprom_write_buffer_set_offset {offset project} {
variable actualProject ;# Object: Current project
variable project_menu_locked ;# Bool: Indicates than there is at least one opened project
- variable opended_eeprom_wr_bf_windows ;# List of project objects with opened data EEPROM write buffer editor
+ variable opened_eeprom_wr_bf_windows ;# List of project objects with opened data EEPROM write buffer editor
variable eeprom_wr_bf_window_objects ;# List of data EEPROM write buffer hex editor objects
if {$project_menu_locked} {return}
- set idx [lsearch -exact -ascii $opended_eeprom_wr_bf_windows [string trimleft $project {:}]]
+ set idx [lsearch -exact -ascii $opened_eeprom_wr_bf_windows [string trimleft $project {:}]]
if {$idx == -1} {return}
if {$offset == {}} {
set offset [mc "< Undefined >"]
@@ -8596,7 +9030,7 @@ namespace eval X {
[lindex $eeprom_wr_bf_window_objects $idx].offset_frame.val configure -text $offset
}
- ## Binding for pseudo-events <cell_enter> and <cell_leave> in data EEPROM write buffer hexeditor
+ ## Binding for pseudo-events <cell_enter> and <cell_leave> in data EEPROM write buffer hex editor
# Set value of curosor label at the bottom of the window
# This function takes list of attributes with any length gerater
#+ than one but only first two are significant
@@ -8622,7 +9056,7 @@ namespace eval X {
# Modify content of cursor label
if {$addr == {}} {
$win.bottom_frame.cur_val configure -text { }
- } {
+ } else {
set addr [format %X $addr]
set len [string length $addr]
if {$len < 4} {
@@ -8634,13 +9068,13 @@ namespace eval X {
set foo_procedure_in_progress 0
}
- ## Invoke hexeditor with data EEPROM write buffer
+ ## Invoke hex editor with data EEPROM write buffer
# @return void
proc __show_eeprom_write_buffer {} {
variable actualProject ;# Object: Current project
variable critical_procedure_in_progress ;# Bool: Disables procedures which takes a long time
variable project_menu_locked ;# Bool: Indicates than there is at least one opened project
- variable opended_eeprom_wr_bf_windows ;# List of project objects with opened data EEPROM write buffer editor
+ variable opened_eeprom_wr_bf_windows ;# List of project objects with opened data EEPROM write buffer editor
variable eeprom_wr_bf_window_objects ;# List of data EEPROM write buffer hex editor objects
variable eeprom_wr_buf_counter ;# Counter of EEPROM write buffer hex editor objects
@@ -8655,7 +9089,7 @@ namespace eval X {
set critical_procedure_in_progress 1
# Check if the dialog is not already opened
- if {[lsearch -exact -ascii $opended_eeprom_wr_bf_windows $actualProject] != -1} {
+ if {[lsearch -exact -ascii $opened_eeprom_wr_bf_windows $actualProject] != -1} {
close_hexedit eeprom_wr_bf $actualProject
set critical_procedure_in_progress 0
return
@@ -8663,11 +9097,11 @@ namespace eval X {
# Create dialog window
incr eeprom_wr_buf_counter
- set win [toplevel .eeprom_write_buffer_${eeprom_wr_buf_counter} -class {EEPROM} -bg {#EEEEEE}]
+ set win [toplevel .eeprom_write_buffer_${eeprom_wr_buf_counter} -class {EEPROM} -bg ${::COMMON_BG_COLOR}]
# Adjust NS variables
lappend eeprom_wr_bf_window_objects $win
- lappend opended_eeprom_wr_bf_windows $actualProject
+ lappend opened_eeprom_wr_bf_windows $actualProject
# Create window header
pack [label $win.header \
@@ -8676,17 +9110,19 @@ namespace eval X {
# Create offset label
set offset_frame [frame $win.offset_frame]
- pack [label $offset_frame.lbl \
- -text [mc "OFFSET = "] \
- -font [font create \
- -size -17 -weight bold \
- -family {helvetica}] \
+ pack [label $offset_frame.lbl \
+ -text [mc "OFFSET = "] \
+ -font [font create \
+ -size [expr {int(-17 * $::font_size_factor)}] \
+ -weight bold \
+ -family {helvetica}] \
] -side left
- pack [label $offset_frame.val \
- -fg {#0000FF} \
- -font [font create \
- -size -17 -weight bold \
- -family {helvetica}] \
+ pack [label $offset_frame.val \
+ -fg {#0000FF} \
+ -font [font create \
+ -size [expr {int(-17 * $::font_size_factor)}] \
+ -weight bold \
+ -family {helvetica}] \
] -side left
pack $offset_frame -anchor w
@@ -8712,13 +9148,13 @@ namespace eval X {
-compound left \
-image ::ICONS::16::button_cancel \
-command "X::close_hexedit eeprom_wr_bf $actualProject" \
- ] -side left -anchor w
- pack [label $bottom_frame.cur_val \
- -text { } -fg {#0000FF} \
- -font [font create \
- -family $::DEFAULT_FIXED_FONT \
- -size -12 \
- -weight bold \
+ ] -side left -anchor w -padx 2 -pady 2
+ pack [label $bottom_frame.cur_val \
+ -text { } -fg {#0000FF} \
+ -font [font create \
+ -family $::DEFAULT_FIXED_FONT \
+ -size [expr {int(-12 * $::font_size_factor)}] \
+ -weight bold \
] \
] -side right -anchor e -padx 5
pack [label $bottom_frame.cur_lbl \
@@ -8728,7 +9164,7 @@ namespace eval X {
# Configure dialog window
wm iconphoto $win ::ICONS::16::kcmmemory
- wm title $win [mc "EEPROM write buffer - %s - MCU 8051 IDE" $actualProject]
+ wm title $win [mc "EEPROM write buffer - %s - MCU 8051 IDE" [$actualProject cget -projectName]]
wm resizable $win 0 0
wm protocol $win WM_DELETE_WINDOW \
"X::close_hexedit eeprom_wr_bf $actualProject"
@@ -8744,51 +9180,51 @@ namespace eval X {
# @parm Object project - Project object descriptor
# @return void
proc close_hexedit {type project} {
- variable opended_code_mem_windows ;# List of project object with opened CODE memory hex editor
+ variable opened_code_mem_windows ;# List of project object with opened CODE memory hex editor
variable code_mem_window_objects ;# List of CODE memory hex editor objects
- variable opended_xdata_mem_windows ;# List of project object with opened XDATA memory hex editor
+ variable opened_xdata_mem_windows ;# List of project object with opened XDATA memory hex editor
variable xdata_mem_window_objects ;# List of XDATA memory hex editor objects
- variable opended_eram_windows ;# List of project object with opened ERAM hex editor
+ variable opened_eram_windows ;# List of project object with opened ERAM hex editor
variable eram_window_objects ;# List of ERAM hex editor objects
- variable opended_eeprom_mem_windows ;# List of project object with opened data EEPROM hex editor
+ variable opened_eeprom_mem_windows ;# List of project object with opened data EEPROM hex editor
variable eeprom_mem_window_objects ;# List of data EEPROM hex editor objects
- variable opended_eeprom_wr_bf_windows ;# List of project objects with opened data EEPROM write buffer editor
+ variable opened_eeprom_wr_bf_windows ;# List of project objects with opened data EEPROM write buffer editor
variable eeprom_wr_bf_window_objects ;# List of data EEPROM write buffer hex editor objects
variable critical_procedure_in_progress ;# Bool: Disables procedures which takes a long time
# Close CODE memory editor
if {$type == {code}} {
- set opended_windows_var {opended_code_mem_windows}
+ set opened_windows_var {opened_code_mem_windows}
set window_objects_var {code_mem_window_objects}
- set opended_windows $opended_code_mem_windows
+ set opened_windows $opened_code_mem_windows
set window_objects $code_mem_window_objects
# Close ERAM editor
} elseif {$type == {eram}} {
- set opended_windows_var {opended_eram_windows}
+ set opened_windows_var {opened_eram_windows}
set window_objects_var {eram_window_objects}
- set opended_windows $opended_eram_windows
+ set opened_windows $opened_eram_windows
set window_objects $eram_window_objects
# Close XDATA memory editor
} elseif {$type == {xdata}} {
- set opended_windows_var {opended_xdata_mem_windows}
+ set opened_windows_var {opened_xdata_mem_windows}
set window_objects_var {xdata_mem_window_objects}
- set opended_windows $opended_xdata_mem_windows
+ set opened_windows $opened_xdata_mem_windows
set window_objects $xdata_mem_window_objects
# Close data EEPROM editor
} elseif {$type == {eeprom}} {
- set opended_windows_var {opended_eeprom_mem_windows}
+ set opened_windows_var {opened_eeprom_mem_windows}
set window_objects_var {eeprom_mem_window_objects}
- set opended_windows $opended_eeprom_mem_windows
+ set opened_windows $opened_eeprom_mem_windows
set window_objects $eeprom_mem_window_objects
# Close EEPROM write buffer
} elseif {$type == {eeprom_wr_bf}} {
- set opended_windows_var {opended_eeprom_wr_bf_windows}
+ set opened_windows_var {opened_eeprom_wr_bf_windows}
set window_objects_var {eeprom_wr_bf_window_objects}
- set opended_windows $opended_eeprom_wr_bf_windows
+ set opened_windows $opened_eeprom_wr_bf_windows
set window_objects $eeprom_wr_bf_window_objects
# Close project independent hexadecimal editor
@@ -8802,16 +9238,16 @@ namespace eval X {
# Determinate editor index
- set idx [lsearch -exact -ascii $opended_windows $project]
+ set idx [lsearch -exact -ascii $opened_windows $project]
if {$idx == -1} {return}
# Destroy editor object
if {$type == {eeprom_wr_bf}} {
destroy [lindex $window_objects $idx]
- } {
+ } else {
delete object [lindex $window_objects $idx]
}
# Delete references
- set $opended_windows_var [lreplace $opended_windows $idx $idx]
+ set $opened_windows_var [lreplace $opened_windows $idx $idx]
set $window_objects_var [lreplace $window_objects $idx $idx]
}
@@ -8828,19 +9264,19 @@ namespace eval X {
if {[$actualProject editor_procedure {} cget -modified]} {
append title {[modified] }
}
- append title $actualProject
+ append title [$actualProject cget -projectName]
append title { : }
append title [$actualProject editor_procedure {} cget -filename]
append title { - MCU 8051 IDE}
wm title . $title
# Error -- default title
- }]} {
+ }]} then {
wm title . ${::APPNAME}
}
# No project opened -- default title
- } {
+ } else {
wm title . ${::APPNAME}
}
}
@@ -8850,11 +9286,11 @@ namespace eval X {
proc __sim_clear_highlight {} {
variable project_menu_locked ;# Bool: Indicates than there is at least one opened project
variable actualProject ;# Object: Current project
- variable opended_xdata_mem_windows ;# List of project object with opened XDATA memory hex editor
+ variable opened_xdata_mem_windows ;# List of project object with opened XDATA memory hex editor
variable xdata_mem_window_objects ;# List of XDATA memory hex editor objects
- variable opended_eram_windows ;# List of project object with opened ERAM hex editor
+ variable opened_eram_windows ;# List of project object with opened ERAM hex editor
variable eram_window_objects ;# List of ERAM hex editor objects
- variable opended_eeprom_mem_windows ;# List of project object with opened data EEPROM hex editor
+ variable opened_eeprom_mem_windows ;# List of project object with opened data EEPROM hex editor
variable eeprom_mem_window_objects ;# List of data EEPROM hex editor objects
if {$project_menu_locked} {return}
@@ -8863,15 +9299,15 @@ namespace eval X {
$actualProject bitmap_clear_hg
$actualProject sfrmap_clear_hg
- set idx [lsearch -exact -ascii $opended_xdata_mem_windows $actualProject]
+ set idx [lsearch -exact -ascii $opened_xdata_mem_windows $actualProject]
if {$idx != -1} {
[lindex $xdata_mem_window_objects $idx] clear_highlight
}
- set idx [lsearch -exact -ascii $opended_eram_windows $actualProject]
+ set idx [lsearch -exact -ascii $opened_eram_windows $actualProject]
if {$idx != -1} {
[lindex $eram_window_objects $idx] clear_highlight
}
- set idx [lsearch -exact -ascii $opended_eeprom_mem_windows $actualProject]
+ set idx [lsearch -exact -ascii $opened_eeprom_mem_windows $actualProject]
if {$idx != -1} {
[lindex $eeprom_mem_window_objects $idx] clear_highlight
}
@@ -8920,7 +9356,7 @@ namespace eval X {
-parent . \
-type ok \
-icon warning \
- -title [mc "Unable to compile"] \
+ -title [mc "Unable to comply"] \
-message [mc "This operation cannot be performed on an untitled file"]
return
}
@@ -8930,7 +9366,7 @@ namespace eval X {
-parent . \
-type ok \
-icon warning \
- -title [mc "Unable to compile"] \
+ -title [mc "Unable to comply"] \
-message [mc "This file does not contain any part of the running program"]
return
}
@@ -8942,7 +9378,7 @@ namespace eval X {
set line2pc $line2pc_org_line
# Create dialog window
- set win [toplevel .goto_line2pc -class [mc "Goto dialog"] -bg {#EEEEEE}]
+ set win [toplevel .goto_line2pc -class [mc "Goto dialog"] -bg ${::COMMON_BG_COLOR}]
# Create window label frame
label $win.header \
@@ -8952,16 +9388,18 @@ namespace eval X {
# Create middle frame
set middle_frame [frame $win.middle_frame]
- pack [label $middle_frame.left_lbl \
- -text [mc "PC = "] \
- -font [font create \
- -size -16 -weight bold \
- -family {helvetica}] \
+ pack [label $middle_frame.left_lbl \
+ -text [mc "PC = "] \
+ -font [font create \
+ -size [expr {int(-16 * $::font_size_factor)}] \
+ -weight bold \
+ -family {helvetica}] \
] -side left
- set line2pc_value_lbl [label $middle_frame.right_lbl \
- -font [font create \
- -size -16 -weight bold \
- -family {helvetica}] \
+ set line2pc_value_lbl [label $middle_frame.right_lbl \
+ -font [font create \
+ -size [expr {int(-16 * $::font_size_factor)}] \
+ -weight bold \
+ -family {helvetica}] \
]
pack $line2pc_value_lbl -side left
set middle_right_frame [frame $middle_frame.right_frame]
@@ -8984,14 +9422,14 @@ namespace eval X {
-image ::ICONS::16::ok \
-command {X::line2pc_OK} \
]
- pack $line2pc_ok_button -side left
+ pack $line2pc_ok_button -side left -padx 2
pack [ttk::button $buttonFrame.cancel \
-text [mc "Cancel"] \
-compound left \
-image ::ICONS::16::button_cancel \
-command {X::line2pc_CANCEL} \
] -side left
- pack $buttonFrame -after $middle_frame -pady 5
+ pack $buttonFrame -after $middle_frame -pady 5 -padx 2
## Create top frame
set topFrame [ttk::labelframe $win.topFrame -labelwidget $win.header -relief flat]
@@ -9004,19 +9442,20 @@ namespace eval X {
-variable ::X::line2pc \
-command "
set ::X::line2pc \[expr {int(\${::X::line2pc})}\]
+ ::X::line2pc_validate \$::X::line2pc $topFrame.spinbox
$topFrame.spinbox selection range 0 end
#" \
] -side left -expand 1 -fill x -padx 2
DynamicHelp::add $topFrame.scale \
-text [mc "Graphical representation of the line where to go"]
# Create spinbox widget
- pack [spinbox $topFrame.spinbox \
- -from 1 -to $line2pc_line_max \
- -textvariable X::line2pc \
- -validate all \
- -vcmd {X::line2pc_validate [expr {int(%P)}] %W} \
- -width 4 \
- -command "$topFrame.spinbox selection range 0 end ;#" \
+ pack [ttk::spinbox $topFrame.spinbox \
+ -from 1 -to $line2pc_line_max \
+ -textvariable ::X::line2pc \
+ -validate all \
+ -validatecommand {::X::line2pc_validate %P %W} \
+ -command "::X::line2pc_validate \$::X::line2pc $topFrame.spinbox" \
+ -width 4 \
] -side left
DynamicHelp::add $topFrame.spinbox -text [mc "Line where to go"]
@@ -9032,7 +9471,7 @@ namespace eval X {
# Nessesary window manager options -- modal window
wm iconphoto $win ::ICONS::16::exec
wm title $win [mc "Line to address"]
- wm minsize $win 350 100
+ wm minsize $win 380 140
wm protocol $win WM_DELETE_WINDOW {
X::line2pc_CANCEL
}
@@ -9055,9 +9494,16 @@ namespace eval X {
variable line2pc_ok_button ;# Widget: Button "OK"
variable line2pc_file_number ;# Int: File number
+ if {$content == {}} {
+ return 1
+ }
+
# Validate the given string
- if {![string is digit $content] || $content > $line2pc_line_max || $content < 0} {
- $line2pc_spinbox configure -bg {#FFFFFF}
+ set content [regsub {\..*$} $content {}]
+ if {![string is digit $content] || ($content > $line2pc_line_max) || ($content < 0)} {
+ catch {
+ $line2pc_spinbox configure -style TSpinbox
+ }
return 0
}
@@ -9073,12 +9519,14 @@ namespace eval X {
-text [mc "Unable to resolve"]
code_hex_editor_directly_move_program_pointer $actualProject -1
- $actualProject editor_procedure {} unset_simulator_line {} ;# Adjust editor
- $line2pc_ok_button configure -state disabled ;# Adjust Ok button
- $line2pc_spinbox configure -bg {#FFCCCC} ;# Adjust SpinBox
+ $actualProject editor_procedure {} unset_simulator_line {} ;# Adjust editor
+ $line2pc_ok_button configure -state disabled ;# Adjust Ok button
+ catch {
+ $line2pc_spinbox configure -style RedBg.TSpinbox ;# Adjust SpinBox
+ }
# Success
- } {
+ } else {
# Translate address to hexadecimal system
set addr_in_hex [format %X $line2pc_new_value]
set len [string length $addr_in_hex]
@@ -9092,8 +9540,10 @@ namespace eval X {
# Adjust editor
code_hex_editor_directly_move_program_pointer $actualProject $line2pc_new_value
$actualProject move_simulator_line [list $content $line2pc_file_number]
- $line2pc_ok_button configure -state normal ;# Adjust Ok button
- $line2pc_spinbox configure -bg {#CCFFCC} ;# Adjust SpinBox
+ $line2pc_ok_button configure -state normal ;# Adjust Ok button
+ catch {
+ $line2pc_spinbox configure -style GreenBg.TSpinbox ;# Adjust SpinBox
+ }
}
return 1
}
@@ -9115,7 +9565,7 @@ namespace eval X {
if {$line2pc_org_line == {}} {
$actualProject editor_procedure {} unset_simulator_line {}
- } {
+ } else {
$actualProject move_simulator_line $line2pc_org_line
}
code_hex_editor_directly_move_program_pointer $actualProject -1
@@ -9140,7 +9590,7 @@ namespace eval X {
$actualProject move_simulator_line $line2pc
if {$line2pc_jump} {
$actualProject setPC $line2pc_new_value
- } {
+ } else {
$actualProject simulator_subprog_call $line2pc_new_value
}
code_hex_editor_directly_move_program_pointer $actualProject -1
@@ -9154,7 +9604,7 @@ namespace eval X {
# @return void
proc __prev_editor_from_pmenu {} {
variable actualProject ;# Object: Current project
- variable selectedView ;# Int: Selected editor view
+ variable selectedView ;# Object: Selected editor view
variable critical_procedure_in_progress ;# Bool: Disables procedures which takes a long time
variable project_menu_locked ;# Bool: Indicates than there is at least one opened project
@@ -9176,7 +9626,7 @@ namespace eval X {
# @return void
proc __next_editor_from_pmenu {} {
variable actualProject ;# Object: Current project
- variable selectedView ;# Int: Selected editor view
+ variable selectedView ;# Object: Selected editor view
variable critical_procedure_in_progress ;# Bool: Disables procedures which takes a long time
variable project_menu_locked ;# Bool: Indicates than there is at least one opened project
@@ -9227,7 +9677,7 @@ namespace eval X {
## Close current view (editor) from editor statusbar popup menu
# @return void
proc __close_current_view_from_pmenu {} {
- variable selectedView ;# Int: Selected editor view
+ variable selectedView ;# Object: Selected editor view
variable actualProject ;# Object: Current project
variable project_menu_locked ;# Bool: Indicates than there is at least one opened project
@@ -9305,7 +9755,7 @@ namespace eval X {
if {$hib_res} {
set title [mc "Hibernate running program - MCU 8051 IDE"]
set cmd {__hibernate_to}
- } {
+ } else {
set title [mc "Resume hibernated program - MCU 8051 IDE"]
set cmd {__resume_from}
}
@@ -9315,10 +9765,10 @@ namespace eval X {
KIFSD::FSD fsd \
-title $title -initialfile $initialfile \
-directory [$actualProject cget -projectPath] \
- -defaultmask 0 -multiple 0 -filetypes {
- {{MCU 8051 IDE Hibernated program} {*.m5ihib} }
- {{All files} {*} }
- }
+ -defaultmask 0 -multiple 0 -filetypes [list \
+ [list [mc "MCU 8051 IDE hibernated program"] {*.m5ihib} ] \
+ [list [mc "All files"] {*} ] \
+ ]
# Open file after press of OK button
fsd setokcmd "
@@ -9352,11 +9802,11 @@ namespace eval X {
# Adjust the given name of the target file
if {!$::MICROSOFT_WINDOWS} { ;# POSIX way
if {![regexp "^(~|/)" $filename]} {
- set filename "[${X::actualProject} cget -ProjectDir]/$filename"
+ set filename "[${::X::actualProject} cget -ProjectDir]/$filename"
}
- } { ;# Microsoft windows way
- if {![regexp "^\w:" $filename]} {
- set filename [file join [${X::actualProject} cget -ProjectDir] $filename]
+ } else { ;# Microsoft windows way
+ if {![regexp {^\w:} $filename]} {
+ set filename [file join [${::X::actualProject} cget -ProjectDir] $filename]
}
}
if {[file extension $filename] == {}} {
@@ -9374,7 +9824,7 @@ namespace eval X {
-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
@@ -9390,7 +9840,7 @@ namespace eval X {
}
if {![$actualProject hibernate_hibernate \
$filename [file tail $sourcefile] $sourcefile_md5 0 \
- ]} {
+ ]} then {
tk_messageBox \
-parent . \
-type ok \
@@ -9419,11 +9869,11 @@ namespace eval X {
# Adjust the given name of the target file
if {!$::MICROSOFT_WINDOWS} { ;# POSIX way
if {![regexp "^(~|/)" $filename]} {
- set filename "[${X::actualProject} cget -ProjectDir]/$filename"
+ set filename "[${::X::actualProject} cget -ProjectDir]/$filename"
}
- } { ;# Microsoft windows way
- if {![regexp "^\w:" $filename]} {
- set filename [file join [${X::actualProject} cget -ProjectDir] $filename]
+ } else { ;# Microsoft windows way
+ if {![regexp {^\w:} $filename]} {
+ set filename [file join [${::X::actualProject} cget -ProjectDir] $filename]
}
}
set filename [file normalize $filename]
@@ -9452,7 +9902,7 @@ namespace eval X {
}
## Invoke interrupt monitor window
- # @parm Object project_object = actualProject - Project
+ # @parm Object project_object=actualProject - Project
# @return void
proc __interrupt_monitor args {
variable actualProject ;# Object: Current project
@@ -9461,13 +9911,24 @@ namespace eval X {
if {$project_menu_locked} {return}
if {[string length $args]} {
$args interrupt_monitor_invoke_dialog
- } {
+ } else {
$actualProject interrupt_monitor_invoke_dialog
}
}
+ ## Invoke UART monitor window
+ # @return void
+ proc __uart_monitor args {
+ variable actualProject ;# Object: Current project
+ variable project_menu_locked ;# Bool: Indicates than there is at least one opened project
+
+ if {$project_menu_locked} {return}
+
+ $actualProject uart_monitor_invoke_dialog
+ }
+
## Invoke stack monitor window
- # @parm Object project_object = actualProject - Project
+ # @parm Object project_object=actualProject - Project
# @return void
proc __stack_monitor args {
variable actualProject ;# Object: Current project
@@ -9476,7 +9937,7 @@ namespace eval X {
if {$project_menu_locked} {return}
if {[string length $args]} {
$args stack_monitor_invoke_dialog
- } {
+ } else {
$actualProject stack_monitor_invoke_dialog
}
}
@@ -9525,7 +9986,7 @@ namespace eval X {
}
## Invoke independent hexadecimal editor
- # @return Object - Hexeditor object reference
+ # @return Object - Hex editor object reference
proc __hexeditor {} {
variable independent_hexeditor_count ;# Counter of intances of independent hexadecimal editor
incr independent_hexeditor_count
@@ -9543,7 +10004,7 @@ namespace eval X {
$actualProject editor_procedure {} document_current_func {}
}
- ## Create doxygen configguration file if it does not already exist
+ ## Create doxygen configuration file if it does not already exist
# @return void
proc create_doxyfile {} {
variable doxygen_pid ;# Int: Doxygen PID
@@ -9555,7 +10016,7 @@ namespace eval X {
-parent . \
-type ok \
-icon warning \
- -title [mc "Unable to compile"] \
+ -title [mc "Unable to comply"] \
-message [mc "Something is already running in background."]
return
}
@@ -9564,30 +10025,60 @@ namespace eval X {
make_progressBar_on_Sbar
if {[catch {
+ set path [$actualProject cget -projectPath]
+ if {$::MICROSOFT_WINDOWS} {
+ regsub -all {/} $path "\\" path
+ }
+ $actualProject messages_text_append "\ncd $path\n"
cd [$actualProject cget -projectPath]
- }]} {
+ }]} then {
tk_messageBox \
-parent . \
-type ok \
-icon warning \
-title [mc "Permission denied"] \
- -message [mc "Unable to change diectory to '%s'." [$actualProject cget -projectPath]]
+ -message [mc "Unable to change directory to '%s'." [$actualProject cget -projectPath]]
return
}
- if {![file exists Doxyfile]} {
- $actualProject messages_text_append "\ndoxygen -g Doxyfile\n"
- set doxygen_pid [exec -- \
- doxygen -g Doxyfile && doxygen -u Doxyfile |& \
- tclsh ${::LIB_DIRNAME}/external_command.tcl [tk appname] \
- ::X::doxygen_finish ::X::doxygen_message & \
- ]
- } {
- $actualProject messages_text_append "\ndoxygen -u Doxyfile\n"
- set doxygen_pid [exec -- \
- doxygen -u Doxyfile |& tclsh \
- ${::LIB_DIRNAME}/external_command.tcl [tk appname] \
- ::X::doxygen_finish ::X::doxygen_message & \
- ]
+ if {!$::MICROSOFT_WINDOWS} {
+ if {![file exists Doxyfile]} {
+ $actualProject messages_text_append "doxygen -g Doxyfile\n"
+ set doxygen_pid [exec -- \
+ doxygen -g Doxyfile && doxygen -u Doxyfile |& \
+ tclsh ${::LIB_DIRNAME}/external_command.tcl [tk appname] \
+ ::X::doxygen_finish ::X::doxygen_message & \
+ ]
+ } else {
+ $actualProject messages_text_append "doxygen -u Doxyfile\n"
+ set doxygen_pid [exec -- \
+ doxygen -u Doxyfile |& tclsh \
+ ${::LIB_DIRNAME}/external_command.tcl [tk appname] \
+ ::X::doxygen_finish ::X::doxygen_message & \
+ ]
+ }
+ } else {
+ if {![file exists Doxyfile]} {
+ $actualProject messages_text_append "doxygen -g Doxyfile\n"
+ set doxygen_pid [exec -- \
+ doxygen -g Doxyfile && doxygen -u Doxyfile \
+ |& \
+ "${::INSTALLATION_DIR}/external_command.bat" \
+ "${::INSTALLATION_DIR}/external_command.exe" \
+ "[tk appname]" \
+ ::X::doxygen_finish ::X::doxygen_message & \
+ ]
+ } else {
+ $actualProject messages_text_append "doxygen -u Doxyfile\n"
+ set doxygen_pid [exec -- \
+ doxygen -u Doxyfile \
+ |& \
+ "${::INSTALLATION_DIR}/external_command.bat" \
+ "${::INSTALLATION_DIR}/external_command.exe" \
+ "[tk appname]" \
+ ::X::doxygen_finish ::X::doxygen_message & \
+ ]
+ }
+
}
}
@@ -9606,8 +10097,8 @@ namespace eval X {
set doxygen_build_api_doc 0
if {[catch {
cd [$actualProject cget -projectPath]
- }]} {
- $actualProject messages_text_append [mc "\nUnable to change diectory to '%s'\n" [$actualProject cget -projectPath]]
+ }]} then {
+ $actualProject messages_text_append [mc "\nUnable to change directory to '%s'\n" [$actualProject cget -projectPath]]
destroy_progressBar_on_Sbar
set compilation_in_progress 0
set doxygen_pid 0
@@ -9652,13 +10143,13 @@ namespace eval X {
-parent . \
-type ok \
-icon warning \
- -title [mc "Unable to compile"] \
+ -title [mc "Unable to comply"] \
-message [mc "Something is already running in background."]
return
}
set doxygen_mess_project $actualProject
set doxygen_build_api_doc 1
- if {!$::PROGRAM_AVALIABLE(doxygen)} {
+ if {!$::PROGRAM_AVAILABLE(doxygen)} {
tk_messageBox \
-parent . \
-type ok \
@@ -9671,7 +10162,7 @@ namespace eval X {
create_doxyfile
}
- ## Run doxygen graphical frontend
+ ## Run doxygen graphical front-end
# @return void
proc __run_doxywizard {} {
variable doxygen_mess_project ;# Object: Project related to running doxygen compilation
@@ -9680,7 +10171,7 @@ namespace eval X {
variable project_menu_locked ;# Bool: Indicates than there is at least one opened project
if {$project_menu_locked} {return}
- if {!$::PROGRAM_AVALIABLE(doxywizard)} {
+ if {!$::PROGRAM_AVAILABLE(doxywizard)} {
tk_messageBox \
-parent . \
-type ok \
@@ -9706,8 +10197,8 @@ namespace eval X {
set doxygen_mess_project $actualProject
if {[catch {
cd [$actualProject cget -projectPath]
- }]} {
- $actualProject messages_text_append [mc "\nError: Unable to change diectory to '%s'\n" [$actualProject cget -projectPath]]
+ }]} then {
+ $actualProject messages_text_append [mc "\nError: Unable to change directory to '%s'\n" [$actualProject cget -projectPath]]
return
}
@@ -9734,19 +10225,19 @@ namespace eval X {
-parent . \
-icon warning \
-type ok \
- -title [mc "Unable to compile"] \
+ -title [mc "Unable to comply"] \
-message [mc "Unable to gain file statistics while external editor is used"]
return
}
# Create dialog window (not modal)
incr statistics_counter
- set win [toplevel .statistics$statistics_counter -class {File statistics} -bg {#EEEEEE}]
+ set win [toplevel .statistics$statistics_counter -class {File statistics} -bg ${::COMMON_BG_COLOR}]
# Local variables
- set bold_font [font create -family {helvetica} -size -12 -weight bold]
- set normal_font [font create -family {helvetica} -size -12 -weight normal]
- set header_font [font create -family {helvetica} -size -20 -weight normal]
+ set bold_font [font create -family {helvetica} -size [expr {int(-12 * $::font_size_factor)}] -weight bold]
+ set normal_font [font create -family {helvetica} -size [expr {int(-12 * $::font_size_factor)}] -weight normal]
+ set header_font [font create -family {helvetica} -size [expr {int(-20 * $::font_size_factor)}] -weight normal]
set statistics [$actualProject editor_procedure {} getFileStatistics {}]
# Create window header
@@ -9784,7 +10275,7 @@ namespace eval X {
grid [Label $main_frame.c_other_name_lbl \
-text [mc "Other characters:"] \
-font $normal_font -pady 0 \
- -helptext [mc "All other charactes without EOLs (e.g. spaces and brackets)"] \
+ -helptext [mc "All other characters without EOLs (e.g. spaces and brackets)"] \
] -row 3 -column 1 -sticky w
grid [label $main_frame.c_other_value_lbl \
-text [lindex $statistics 2] \
@@ -9798,7 +10289,7 @@ namespace eval X {
grid [Label $main_frame.c_total_name_lbl \
-text [mc "Total characters:"] \
-font $normal_font -pady 0 \
- -helptext [mc "All charactes in the text without EOLs"] \
+ -helptext [mc "All characters in the text without EOLs"] \
] -row 5 -column 1 -sticky w
grid [label $main_frame.c_total_value_lbl \
-text [lindex $statistics 3] \
@@ -9861,7 +10352,7 @@ namespace eval X {
grid [Label $main_frame.l_empty_name_lbl \
-text [mc "Empty lines:"] \
-font $normal_font -pady 0 \
- -helptext [mc "Totaly empty lines (without even spaces)"] \
+ -helptext [mc "Totally empty lines (without even spaces)"] \
] -row 15 -column 1 -sticky w
grid [label $main_frame.l_empty_value_lbl \
-text [lindex $statistics 8] \
@@ -9915,18 +10406,18 @@ namespace eval X {
-compound left \
-image ::ICONS::16::ok \
-command "X::statistics_close $statistics_counter" \
- ] -side right
+ ] -side right -padx 2
pack [ttk::button $button_frame.copy \
-text [mc "Copy"] \
-compound left \
-image ::ICONS::16::editcopy \
-command "X::statistics_copy $statistics_counter" \
- ] -side left
+ ] -side left -padx 2
# Pack dialog frames
pack $dialog_header -side top -fill x -pady 5
pack $main_frame -side top -anchor nw -fill x -pady 15 -padx 10
- pack $button_frame -side bottom -anchor se
+ pack $button_frame -side bottom -anchor se -pady 5 -padx 5
# Set window manager options
wm iconphoto $win ::ICONS::16::graph
@@ -9980,15 +10471,15 @@ namespace eval X {
clipboard append [mc " Total lines:\t\t\t%s\n" [$main_frame.l_total_value_lbl cget -text]]
}
- ## Modify main menu and main toolbar acording to configuration of the current editor
+ ## Modify main menu and main toolbar according to configuration of the current editor
# @parm Bool read_only - 1 == Read only; 0 == Normal mode; {} == Do not change
# @parm Bool c_language - 1 == Uses C language; 0 == Uses Assembler; {} == Do not change
# @return void
proc adjust_mainmenu_and_toolbar_to_editor {read_only c_language} {
- variable mainmenu_editor_readonly ;# Menu bar items which are not avaliable when editor is in read only mode
- variable toolbar_editor_readonly ;# Tool bar items which are not avaliable when editor is in read only mode
- variable mainmenu_editor_c_only ;# Menu bar items which are not avaliable only for C language
- variable toolbar_editor_c_only ;# Toolbar items which are not avaliable only for C language
+ variable mainmenu_editor_readonly ;# Menu bar items which are not available when editor is in read only mode
+ variable toolbar_editor_readonly ;# Tool bar items which are not available when editor is in read only mode
+ variable mainmenu_editor_c_only ;# Menu bar items which are not available only for C language
+ variable toolbar_editor_c_only ;# Toolbar items which are not available only for C language
# Read only flag
if {$read_only != {}} {
@@ -10005,11 +10496,11 @@ namespace eval X {
}
## Conditionaly disable menu and toolbar items which
- #+ are not avaliable when external editor used
+ #+ are not available when external editor used
# @return void
proc adjust_mm_and_tb_ext_editor {} {
- variable mainmenu_editor_external_na ;# Menu bar items which are not avaliable when external embedded editor is used
- variable toolbar_editor_external_na ;# Toolbar items which are not avaliable when external embedded editor is used
+ variable mainmenu_editor_external_na ;# Menu bar items which are not available when external embedded editor is used
+ variable toolbar_editor_external_na ;# Toolbar items which are not available when external embedded editor is used
if {!${::Editor::editor_to_use}} {
return
@@ -10041,10 +10532,10 @@ namespace eval X {
}
}
- ## Invoke 8-segment LED display editor
+ ## Invoke 8-Segment LED display editor
# @return void
proc __eightsegment {} {
- variable eightsegment_editors ;# List: All 8-segment LED display editors invoked
+ variable eightsegment_editors ;# List: All 8-Segment LED display editors invoked
lappend eightsegment_editors [EightSegment #auto]
}
@@ -10056,11 +10547,11 @@ namespace eval X {
if {$ascii_chart_win_object != {}} {
if {[$ascii_chart_win_object is_visible]} {
$ascii_chart_win_object raise_window
- } {
+ } else {
$ascii_chart_win_object restore_window
}
- } {
- set ascii_chart_win_object [AsciiChart #this]
+ } else {
+ set ascii_chart_win_object [AsciiChart #auto]
}
}
@@ -10174,6 +10665,7 @@ namespace eval X {
if {$what == 2} {
if {[$actualProject pale_open_scenario $filename]} {
tk_messageBox \
+ -parent . \
-type ok \
-icon error \
-title [mc "IO Error"] \
@@ -10184,6 +10676,7 @@ namespace eval X {
} elseif {$what == -2} {
if {[$actualProject pale_load_scenarion $filename]} {
tk_messageBox \
+ -parent . \
-type ok \
-icon error \
-title [mc "IO Error"] \
@@ -10221,7 +10714,7 @@ namespace eval X {
-parent . \
-title [mc "Error - MCU 8051 IDE"] \
-message [mc "Unable to load file: %s" $filename]
- } {
+ } else {
$actualProject editor_procedure {} highlight_visible_area {}
}
@@ -10311,25 +10804,25 @@ namespace eval X {
Notes #auto {} {}
}
- ## Invoke "Base convertor"
+ ## Invoke "Base converter"
# @return void
- proc __base_convertor {} {
- variable base_convertors ;# List: All base convertor objects
+ proc __base_converter {} {
+ variable base_converters ;# List: All base converter objects
- set obj [BaseConvertor #auto]
- lappend base_convertors ::X::$obj
+ set obj [BaseConverter #auto]
+ lappend base_converters ::X::$obj
return $obj
}
- ## Close "Base convertor"
+ ## Close "Base converter"
# @return void
- proc __base_convertor_close {obj} {
- variable base_convertors ;# List: All base convertor objects
+ proc __base_converter_close {obj} {
+ variable base_converters ;# List: All base converter objects
- set idx [lsearch -ascii -exact $base_convertors $obj]
+ set idx [lsearch -ascii -exact $base_converters $obj]
if {$idx != -1} {
- set base_convertors [lreplace $base_convertors $idx $idx]
+ set base_converters [lreplace $base_converters $idx $idx]
}
}
@@ -10366,6 +10859,191 @@ namespace eval X {
return [LedMatrix #auto $actualProject]
}
+ ## Invoke "Virtual UART Terminal" (section Virtual Hardware)
+ # @return void
+ proc __vhw_UART_terminal {} {
+ variable actualProject ;# Object: Current project
+ variable project_menu_locked ;# Bool: Indicates than there is at least one opened project
+
+ if {$project_menu_locked} {return}
+
+ return [VirtualUARTTerminal #auto $actualProject]
+ }
+
+ ## Invoke "File Interface" (section Virtual Hardware)
+ # @return void
+ proc __vhw_file_interface {} {
+ variable actualProject ;# Object: Current project
+ variable project_menu_locked ;# Bool: Indicates than there is at least one opened project
+
+ if {$project_menu_locked} {return}
+
+ return [PaleFileInterface #auto $actualProject]
+ }
+
+ ## Invoke "LCD display controlled by HD44780" (section Virtual Hardware)
+ # @parm List $display_size={} - Size of the LCD display to create, format: {rows columns}, empty list means invoke size selection dialog
+ # @return void
+ #
+ # Note: If the first argument is omitted then this function will create a "Size selection dialog"
+ proc __vhw_HD44780 {{display_size {}}} {
+ variable actualProject ;# Object: Current project
+ variable project_menu_locked ;# Bool: Indicates than there is at least one opened project
+ variable vhw_HD44780_rect ;# Array: Rectangles in dialog "Set display size"
+ variable vhw_HD44780_canvas ;# Widget: Canvas widget in dialog "Set display size"
+ variable vhw_HD44780_counter ;# Int: Counter of dialog instances
+ variable vhw_HD44780_size_lbl ;# Widget: Label showing the LCD size in dialog "Set display size"
+ variable vhw_HD44780_dialog ;# Widget: Toplevel window of dialog "Set display size"
+ variable vhw_HD44780_size ;# List of Int: LCD display size chosen by the user, {HEIGHT WIDTH}
+
+ # This function requires at least one project opened
+ if {$project_menu_locked} {return}
+
+ # LCD display size specified -- create the display and return
+ if {[llength $display_size]} {
+ set object [LcdHD44780 #auto $actualProject]
+ $object set_config [list [lindex $display_size 0] [lindex $display_size 1]]
+ return $object
+ }
+
+
+ # --------------------------------------------------------------
+ # Create the size selection dialog
+ # --------------------------------------------------------------
+
+ # Create the dialog window
+ set dialog [toplevel .set_lcd_size$vhw_HD44780_counter -class {Set display size} -bg ${::COMMON_BG_COLOR}]
+
+ # Set some namespace variables
+ incr vhw_HD44780_counter ;# Int: Counter of dialog instances
+ set vhw_HD44780_dialog $dialog ;# Widget: Toplevel window of dialog "Set display size"
+ set vhw_HD44780_size {0 0} ;# List of Int: LCD display size chosen by the user, {HEIGHT WIDTH}
+
+ # Create top frame (text: "Set display size" and actual display size)
+ set top_frame [frame $dialog.top_frame]
+ pack [label $top_frame.header_lbl \
+ -text [mc "Set display size"] \
+ -font [font create \
+ -size [expr {int(-17 * $::font_size_factor)}] \
+ -family {helvetica}] \
+ ] -side left -padx 10
+ set vhw_HD44780_size_lbl [label $top_frame.size_lbl \
+ -text {0 × 0} \
+ -text [mc "Set display size"] \
+ -font [font create \
+ -size [expr {int(-16 * $::font_size_factor)}] \
+ -family {helvetica} -weight {bold}] \
+ ]
+ pack $vhw_HD44780_size_lbl -side right -padx 10
+ pack $top_frame -fill x
+
+ ## Create the matrix of rectangles for display size selection
+ set w 12
+ set h 17
+ set x0 3
+ set x $x0
+ set y 3
+ set canvas [canvas $dialog.canvas \
+ -bg {#FFFFFF} \
+ -height [expr {2 * ($h + 3) + 6}] \
+ -width [expr {40 * ($w + 3) + 6}] \
+ -bd 0 \
+ -highlightthickness 0 \
+ ]
+ set vhw_HD44780_canvas $canvas
+ for {set row 1} {$row <= 2} {incr row} {
+ for {set col 1} {$col <= 40} {incr col} {
+ set r [$canvas create rectangle \
+ $x \
+ $y \
+ [expr {$x + $w}] \
+ [expr {$y + $h}] \
+ -outline {#0000FF} \
+ ]
+
+ incr x $w
+ incr x 3
+
+ set vhw_HD44780_rect($row,$col) $r
+
+ $canvas bind $r <Enter> [list ::X::vhw_HD44780_ENTER $row $col]
+ $canvas bind $r <Leave> [list ::X::vhw_HD44780_ENTER 0 0]
+ $canvas bind $r <Button-1> [list ::X::vhw_HD44780_GO $row $col]
+ }
+ set x $x0
+ incr y $h
+ incr y 3
+ }
+ pack $canvas
+
+ # Set window parameters
+ wm iconphoto $dialog ::ICONS::16::set_lcd_size
+ wm title $dialog [mc "Set display size"]
+ wm resizable $dialog 0 0
+ wm protocol $dialog WM_DELETE_WINDOW {
+ X::vhw_HD44780_CANCEL
+ }
+ wm transient $dialog .
+ update
+ raise $dialog
+ catch {grab $dialog}
+
+ # Wait the dialog window is destroyed
+ tkwait window $dialog
+
+ # If the size was set then create the display
+ if {[lindex $vhw_HD44780_size 0] && [lindex $vhw_HD44780_size 1]} {
+ set object [LcdHD44780 #auto $actualProject]
+ $object set_config [list [lindex $vhw_HD44780_size 0] [lindex $vhw_HD44780_size 1]]
+ return $object
+ }
+ }
+
+ ## Handle pointer enter event in the canvas widget of the LCD display size selection dialog
+ # @parm Int target_row - Designated row
+ # @parm Int target_col - Designated column
+ # @return void
+ proc vhw_HD44780_ENTER {target_row target_col} {
+ variable vhw_HD44780_rect ;# Array: Rectangles in dialog "Set display size"
+ variable vhw_HD44780_canvas ;# Widget: Canvas widget in dialog "Set display size"
+ variable vhw_HD44780_size_lbl ;# Widget: Label showing the LCD size in dialog "Set display size"
+
+ # Adjust appearance of the matrix of rectangles
+ for {set row 1} {$row <= 2} {incr row} {
+ for {set col 1} {$col <= 40} {incr col} {
+ if {$row <= $target_row && $col <= $target_col} {
+ set fill {#AAFFDD}
+ } else {
+ set fill {#FFFFFF}
+ }
+ $vhw_HD44780_canvas itemconfigure $vhw_HD44780_rect($row,$col) -fill $fill
+ }
+ }
+
+ # Adjust contents of the label displaying the designated size
+ $vhw_HD44780_size_lbl configure -text [format {%d × %d} $target_row $target_col]
+ }
+
+ ## Set display size and close the LCD display size selection dialog
+ # @parm Int rows - Number of rows
+ # @parm Int cols - Number of columns
+ # @return void
+ proc vhw_HD44780_GO {rows cols} {
+ variable vhw_HD44780_size ;# List of Int: LCD display size chosen by the user, {HEIGHT WIDTH}
+ set vhw_HD44780_size [list $rows $cols]
+ vhw_HD44780_CANCEL
+ }
+
+ ## Close the LCD display size selection dialog
+ # @return void
+ proc vhw_HD44780_CANCEL {} {
+ variable vhw_HD44780_dialog ;# Widget: Toplevel window of dialog "Set display size"
+
+ if {[winfo exists $vhw_HD44780_dialog]} {
+ destroy $vhw_HD44780_dialog
+ }
+ }
+
## Invoke "Multiplexed LED display" (section Virtual Hardware)
# @return void
proc __vhw_M_LED_display {} {
@@ -10388,6 +11066,17 @@ namespace eval X {
return [SimpleKeyPad #auto $actualProject]
}
+ ## Invoke "DS1620 temperature sensor" (section Virtual Hardware)
+ # @return void
+ proc __vhw_ds1620 {} {
+ variable actualProject ;# Object: Current project
+ variable project_menu_locked ;# Bool: Indicates than there is at least one opened project
+
+ if {$project_menu_locked} {return}
+
+ return [Ds1620 #auto $actualProject]
+ }
+
## Invoke "Matrix keypad" (section Virtual Hardware)
# @return void
proc __vhw_matrix_keypad {} {
@@ -10410,13 +11099,15 @@ namespace eval X {
# Ask user for save modified VHW scenario
if {[${::X::actualProject} pale_modified]} {
if {[tk_messageBox \
- -type yesno \
- -icon question \
+ -parent . \
+ -type yesno \
+ -icon question \
-title [mc "File modified"] \
-message [mc "The current VHW connections have been modified,\ndo you want to save them before closing ?"]
] == {yes}} then {
if {![$actualProject pale_save]} {
tk_messageBox \
+ -parent . \
-type ok \
-icon error \
-title [mc "IO Error"] \
@@ -10431,6 +11122,7 @@ namespace eval X {
-title [mc "Open file - Virtual HW - MCU 8051 IDE"] \
-directory [$actualProject cget -projectPath] \
-defaultmask 0 -multiple 0 -filetypes [list \
+ [list [mc "All relevant"] {*.{vhw,vhc}}] \
[list [mc "Virtual HW"] {*.vhw}] \
[list [mc "VH component"] {*.vhc}] \
[list [mc "All files"] {*}] \
@@ -10441,11 +11133,12 @@ namespace eval X {
set filename [::fsd get]
if {[${::X::actualProject} pale_open_scenario $filename]} {
tk_messageBox \
+ -parent . \
-type ok \
-icon error \
-title [mc "IO Error"] \
-message [mc "Unable to read file:\n\"%s\"" $filename]
- } {
+ } else {
::X::recent_files_add 2 $filename
}
}
@@ -10468,6 +11161,7 @@ namespace eval X {
-title [mc "Load file - Virtual HW - MCU 8051 IDE"] \
-directory [$actualProject cget -projectPath] \
-defaultmask 0 -multiple 1 -filetypes [list \
+ [list [mc "All relevant"] {*.{vhw,vhc}}] \
[list [mc "Virtual HW"] {*.vhw}] \
[list [mc "VH component"] {*.vhc}] \
[list [mc "All files"] {*}] \
@@ -10478,11 +11172,12 @@ namespace eval X {
foreach filename [::fsd get] {
if {[${::X::actualProject} pale_load_scenarion $filename]} {
tk_messageBox \
+ -parent . \
-type ok \
-icon error \
-title [mc "IO Error"] \
-message [mc "Unable to read file:\n\"%s\"" $filename]
- } {
+ } else {
::X::recent_files_add 2 $filename
}
}
@@ -10538,7 +11233,7 @@ namespace eval X {
-title [mc "Overwrite file"] \
-message [mc "A file name '%s' already exists. Do you want to overwrite it ?" [file tail $filename]]
] != {yes}
- } {
+ } then {
set abort 1
}
}
@@ -10546,11 +11241,12 @@ namespace eval X {
if {!$abort} {
if {![${::X::actualProject} pale_save_as $filename]} {
tk_messageBox \
+ -parent . \
-type ok \
-icon error \
-title [mc "IO Error"] \
-message [mc "Unable to save file:\n\"%s\"" $filename]
- } {
+ } else {
::X::recent_files_add 2 $filename
}
}
@@ -10576,14 +11272,14 @@ namespace eval X {
-title [mc "Are you sure ?"] \
-message [mc "Do you really want to remove all virtual hardware from the current simulation scenario ?"]
] != {yes}
- } {
+ } then {
return
}
$actualProject pale_forget_all
}
- ## Toggle fullscreen mode
+ ## Toggle full screen mode
# @return void
proc __toggle_fullscreen {} {
# Normal window
@@ -10592,14 +11288,21 @@ namespace eval X {
.mainIconBar.fullscreen configure -image ::ICONS::22::window_fullscreen
}
wm attributes . -fullscreen 0
- # Fullscreen window
- } {
+ # Full screen window
+ } else {
if {[winfo exists .mainIconBar.fullscreen]} {
.mainIconBar.fullscreen configure -image ::ICONS::22::window_nofullscreen
}
wm attributes . -fullscreen 1
}
+ # Without this help windows won't work properly on MS Windows
+ if {$::MICROSOFT_WINDOWS} {
+ after idle {
+ wm geometry . [wm geometry .]
+ }
+ }
+
# Restore position of bottom pane
after 300 {
foreach project ${::X::openedProjects} {
@@ -10630,19 +11333,189 @@ namespace eval X {
proc __functional_diagram {type} {
}
- ## Invoke a virtual terminal of the given type
- # @parm Int type -
+ ## Open arbitrary URI in user preffered application
+ # @parm String uri -- URI to open
# @return void
- proc __virtual_terminal {type} {
- variable actualProject ;# Object: Current project
- variable project_menu_locked ;# Bool: Indicates than there is at least one opened project
+ proc open_uri {uri} {
+ # On Linux and similars systems we use "xdg-open"
+ if {!$::MICROSOFT_WINDOWS} {
+ catch {
+ exec -- xdg-open $uri &
+ }
- if {$project_menu_locked} {return}
+ # On MS Windows we use its buildin command "start"
+ } else {
+ catch {
+ exec -- "cmd" "/c" "start [regsub -all {[^/\\]+\s[^/\\]*} $uri {"&"}]" &
+ }
+ }
+ }
- switch -- $type {
- {u} {
- $actualProject virtual_uart_termial_invoke_dialog
+ ## Open project web page in user preferred browser
+ # @return void
+ proc __web_page {} {
+ open_uri {http://mcu8051ide.sourceforge.net}
+ }
+
+ ## Open web page for reporting bugs in user preferred browser
+ # @return void
+ proc __bug_report {} {
+ open_uri {http://sourceforge.net/tracker/?group_id=185864&atid=914981}
+ }
+
+ ## Open handbook in user preferred PDF reader
+ # @return void
+ proc __handbook {} {
+ if {[file exists "${::INSTALLATION_DIR}/doc/handbook/mcu8051ide.${::GLOBAL_CONFIG(language)}.pdf"]} {
+ open_uri "${::INSTALLATION_DIR}/doc/handbook/mcu8051ide.${::GLOBAL_CONFIG(language)}.pdf"
+ } else {
+ open_uri "${::INSTALLATION_DIR}/doc/handbook/mcu8051ide.en.pdf"
+ }
+ }
+
+ ## Open web page with SDCC manual in user preferred browser
+ # @return void
+ proc __sdcc_manual {} {
+ open_uri {http://sdcc.sourceforge.net/doc/sdccman.html}
+ }
+
+ ## Open web page with ASEM-51 manual in user preferred browser
+ # @return void
+ proc __asem51_manual {} {
+ open_uri {http://plit.de/asem-51/docs.htm}
+ }
+
+ ## Open interactive 8051 instruction table
+ # @return void
+ proc __table_of_instructions {} {
+ variable table_of_instructions_object ;# Object: Interactive 8051 instruction table
+ if {$table_of_instructions_object != {}} {
+ if {[$table_of_instructions_object is_visible]} {
+ $table_of_instructions_object raise_window
+ } else {
+ $table_of_instructions_object restore_window
}
+ } else {
+ set table_of_instructions_object [TableOfInstructions #auto]
+ }
+ }
+
+ ## Make sure that there are no help windows visible
+ # @return void
+ proc remove_all_help_windows {} {
+ variable openedProjects ;# List of opened projects (Object references)
+
+ foreach project $openedProjects {
+ $project file_details_win_hide
}
+ ::Editor::close_completion_popup_window_NOW
+ close_project_details
+ help_window_hide
}
+
+ ## Perform secure send command
+ # Secure means that it will not crash or something like that in case of any errors.
+ # But instead it will popup an error message to the user (Tk dialog).
+ # @parm List args - Arguments for the send command
+ # @return void
+ proc secure_send args {
+ if {[catch {
+ eval "send $args"
+ } result]} then {
+ puts stderr "Unknown IO Error :: $result"
+ return 1
+
+ } else {
+ return 1
+ }
+ }
+
+ proc __d52 {} {
+ variable critical_procedure_in_progress ;# Bool: Disables procedures which takes a long time
+
+ if {$critical_procedure_in_progress} {return}
+
+ # Create dialog window
+ set win [toplevel .d52_open_dialog -class {Disassemble with D52} -bg ${::COMMON_BG_COLOR}]
+ set mainframe [frame $win.frame]
+
+ # Label, Entry and Button "Input file"
+ grid [Label $mainframe.lbl_input \
+ -text [mc "Input file"] \
+ -helptext [mc "File to disassemble"] \
+ ] -column 1 -row 1 -sticky w
+ grid [ttk::entry $mainframe.entry_input \
+ -textvariable X::input_file \
+ -width 50 \
+ ] -column 2 -row 1 -sticky we
+ DynamicHelp::add $mainframe.entry_input -text [mc "File to disassemble"]
+ grid [ttk::button $mainframe.button_select_input_file \
+ -image ::ICONS::16::fileopen \
+ -takefocus 0 \
+ -style Flat.TButton \
+ -command {
+ # Invoke file selection dialog
+ X::select_input_output 1 {{hex,ihx}} .d52_open_dialog
+ } \
+ ] -column 3 -row 1 -sticky e
+ DynamicHelp::add $mainframe.button_select_input_file \
+ -text [mc "Invoke dialog to select input file"]
+
+ # Create separator
+ grid [ttk::separator $mainframe.separator \
+ -orient horizontal \
+ ] -column 1 -columnspan 3 -row 2 -sticky we -pady 10
+
+ # Create buttons "Ok" and "Cancel"
+ set button_frame [frame $mainframe.button_frame]
+ pack [ttk::button $button_frame.button_ok \
+ -text [mc "Ok"] \
+ -command {X::d52_OK} \
+ -compound left \
+ -image ::ICONS::16::ok \
+ ] -side left -padx 5
+ pack [ttk::button $button_frame.button_cancel \
+ -text [mc "Cancel"] \
+ -command {X::d52_CANCEL} \
+ -compound left \
+ -image ::ICONS::16::button_cancel \
+ ] -side left -padx 5
+ grid $button_frame -column 1 -columnspan 3 -row 3
+
+ pack $mainframe -fill both -expand 1 -padx 5 -pady 5
+
+ # Event bindings (Enter == Ok; Escape == Cancel)
+ bind $win <KeyRelease-Return> {X::d52_OK; break}
+ bind $win <KeyRelease-KP_Enter> {X::d52_OK; break}
+ bind $win <KeyRelease-Escape> {X::d52_CANCEL; break}
+
+ # Set window attributes -- modal window
+ wm iconphoto $win ::ICONS::16::d52
+ wm title $win [mc "Disassemble with D52 - MCU 8051 IDE"]
+ wm minsize $win 450 70
+ wm resizable $win 0 0
+ wm protocol $win WM_DELETE_WINDOW {
+ X::d52_CANCEL
+ }
+ wm transient $win .
+ catch {grab $win}
+ raise $win
+ tkwait window $win
+ }
+
+ proc d52_CANCEL {} {
+ catch {
+ destroy .d52_open_dialog
+ }
+ }
+
+ proc d52_OK {} {
+ variable input_file ;# Input file
+
+ d52_CANCEL
+ }
+}
+
+# >>> File inclusion guard
}
+# <<< File inclusion guard