summaryrefslogtreecommitdiff
path: root/lib/maintab.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/maintab.tcl')
-rw-r--r--[-rwxr-xr-x]lib/maintab.tcl120
1 files changed, 79 insertions, 41 deletions
diff --git a/lib/maintab.tcl b/lib/maintab.tcl
index 57f0351..b0159ab 100755..100644
--- a/lib/maintab.tcl
+++ b/lib/maintab.tcl
@@ -2,7 +2,7 @@
# Part of MCU 8051 IDE ( http://mcu8051ide.sf.net )
############################################################################
-# Copyright (C) 2007-2009 by Martin Ošmera #
+# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 by Martin Ošmera #
# martin.osmera@gmail.com #
# #
# This program is free software; you can redistribute it and#or modify #
@@ -21,6 +21,11 @@
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
############################################################################
+# >>> File inclusion guard
+if { ! [ info exists _MAINTAB_TCL ] } {
+set _MAINTAB_TCL _
+# <<< File inclusion guard
+
# --------------------------------------------------------------------------
# DESCRIPTION
# Manages central widget of this program, each instance of this class
@@ -41,7 +46,7 @@ class MainTab {
public variable projectPath ;# Path to directory where the project file is located
public variable projectFile ;# Name of the project file
public variable procData ;# Processor definition list
- public variable avaliable_SFR ;# List of SFR and SFB which are avaliable on the choosen MCU
+ public variable available_SFR ;# List of SFR and SFB which are available on the choosen MCU
# Compiler configuration related variables
private variable PCC_native_assembler ;# --> ::Compiler::Settings::*
@@ -58,19 +63,20 @@ class MainTab {
private variable PCC_sdcc_scs_str_opt ;# --> ::ExternalCompiler::sdcc_scs_string_options
## Project information variables
- # (P - project; G - general)
+ # (P - project; G - general; S - Special)
public variable P_information_version ;# Project version
public variable P_information_date ;# Date of last project update
public variable G_information_authors ;# List of project authors
public variable G_information_copyright ;# Project copyright information
- public variable G_information_licence ;# Project licence information
+ public variable G_information_license ;# Project license information
+ public variable S_flag_read_only ;# Project is for reading only (e.g. "Demo project")
public variable P_option_mcu_type ;# Processor type (e.g. AT89C51RC)
public variable P_option_clock ;# Project default simulator clock rate
public variable P_option_mcu_xdata ;# Size of external data memory
public variable P_option_mcu_xcode ;# Size of external program memory
public variable P_option_main_file ;# Project main source file
- public variable project_description ;# Project decription text
+ public variable project_description ;# Project description text
public variable todoText ;# Content of TODO list
public variable calculatorList ;# List of values for calculator (see class Calculator)
public variable other_options ;# Other options
@@ -84,9 +90,10 @@ class MainTab {
# @parm List dataList - Data extracted from project file (see NS Project)
constructor {ProjectName projectpath projectfile dataList} {
set projectName $ProjectName
+ set S_flag_read_only 0
#
- ## PARSE PROJECT DATA
+ ## PROCESS PROJECT SPECIFICATION DATA
#
set i 0
@@ -96,7 +103,7 @@ class MainTab {
}
set i 0
- foreach info {authors copyright licence} {
+ foreach info {authors copyright license} {
regsub -all {\\\}} [regsub -all {\\\{} [lindex $dataList "1 $i"] "{"] "}" G_information_$info
incr i
}
@@ -138,37 +145,41 @@ class MainTab {
array set PCC_AS31_config [lindex $dataList {8 10}]
array set PCC_AS31_addcfg [lindex $dataList {8 11}]
}
- } {
+ } else {
retrieve_compiler_settings
}
set projectFiles [lindex $dataList 9]
# Load default values if the given values is not valid
- if {[lsearch ${::X::avaliable_processors} $P_option_mcu_type] == -1} {
+ if {[lsearch ${::X::available_processors} $P_option_mcu_type] == -1} {
set P_option_mcu_type [lindex ${X::project_edit_defaults} {0 1}]
puts stderr "Unsupported processor type -- setting to [lindex ${X::project_edit_defaults} {0 1}]"
}
set procData [SelectMCU::get_processor_details $P_option_mcu_type]
+
+ # set MCU type in status bar, kdb -- Are you sure Kara that this line does anathing??
+ .statusbarMCU configure -text $P_option_mcu_type
+
if {$procData == {}} {
wm withdraw .
tk_messageBox \
-icon error \
-type ok \
-title [mc "FATAL ERROR"] \
- -message [mc "MCUs database file is currupted,\nthis program cannot run without it.\nPlease reinstall MCU 8051 IDE."]
+ -message [mc "MCUs database file is corrupted,\nthis program cannot run without it.\nPlease reinstall MCU 8051 IDE."]
exit 1
}
- refresh_project_avaliable_SFR
- if {![string is digit -strict $P_option_mcu_xdata] || $P_option_mcu_xdata > 0xFFFF} {
+ refresh_project_available_SFR
+ if {![string is digit -strict $P_option_mcu_xdata] || $P_option_mcu_xdata > 0x10000} {
set P_option_mcu_xdata 0
puts "Invalid XDATA capacity -- setting to 0"
}
if {
![string is digit -strict $P_option_mcu_xcode]
||
- $P_option_mcu_xcode > [expr {0xFFFF - ([lindex $procData 2] * 1024)}]
- } {
+ $P_option_mcu_xcode > [expr {0x10000 - ([lindex $procData 2] * 1024)}]
+ } then {
set P_option_mcu_xcode 0
puts "Invalid XCODE capacity -- setting to 0"
}
@@ -178,12 +189,12 @@ class MainTab {
if {[lindex $procData 1] != {yes}} {
set P_option_mcu_xcode 0
}
- if {[regexp {^\d+$} $P_option_clock]} {
+ if {[regexp {^\d+(\.\d+)?$} $P_option_clock]} {
if {$P_option_clock > 99999} {
set P_option_clock [lindex ${X::project_edit_defaults} {1 1}]
puts stderr "Clock value must be below 99999 -- setting to [lindex ${X::project_edit_defaults} {1 1}]"
}
- } {
+ } else {
set P_option_clock [lindex ${X::project_edit_defaults} {1 1}]
puts stderr "Invalid clock value -- setting to [lindex ${X::project_edit_defaults} {1 1}]"
}
@@ -197,32 +208,46 @@ class MainTab {
set projectFile $projectfile
# create higher-level container
- set mainTab [.mainFrame.mainNB insert end \
- [string trimleft $this {:}] \
- -text $projectName \
- -image ::ICONS::16::kcmdevices \
- -raisecmd "X::switch_project $this" \
+ set mainTab [${::main_nb} insert end \
+ [string trimleft $this {:}] \
+ -text $projectName \
+ -image ::ICONS::16::kcmdevices \
+ -raisecmd [list X::switch_project $this] \
]
-
- # Some workaround -- only a "cosmetic" matter
- catch {
- .mainFrame.mainNB.c bind p:[string trimleft $this {:}] <Enter> {}
+ after idle {
+ update
+ foreach project ${::X::openedProjects} {
+ $project bottomNB_redraw_pane
+ }
}
+ # Invoke progress dialog
+ set ::FileList::open_files_cur_file [mc "Initializing ..."]
+ create_progress_bar .prgDl \
+ . \
+ ::FileList::open_files_cur_file \
+ {} \
+ ::FileList::open_files_progress \
+ 0 \
+ [mc "Opening project files"] \
+ ::ICONS::16::fileopen \
+ [mc "Abort"] \
+ {set ::FileList::open_files_abort 1}
+
# create paned windows
set main_Pane [panedwindow $mainTab.main_Pane \
-orient vertical \
- -sashwidth 2 \
+ -sashwidth 4 \
-showhandle 0 \
-opaqueresize 1 \
- -sashrelief flat \
+ -sashrelief raised \
]
set top_Pane [panedwindow $main_Pane.top_Pane \
-orient horizontal \
-sashwidth 2 \
-showhandle 0 \
-opaqueresize 1 \
- -sashrelief flat \
+ -sashrelief raised \
]
set fileList_Pane [panedwindow $top_Pane.fileList_Pane \
-orient horizontal \
@@ -244,19 +269,19 @@ class MainTab {
# Intialize all panels
simulator_initialize_mcu
- Initialize_rightPanel $rightPanel $top_Pane $watches_file
- initiate_BottomNoteBook $bottom_pane $main_Pane $todoText $calculatorList $graphList
- initiate_FileList $fileList_Pane $projectPath $projectFiles $editor_sw_lock
+ initialize_rightPanel $rightPanel $top_Pane $watches_file
+ initalize_BottomNoteBook $bottom_pane $main_Pane $todoText $calculatorList $graphList
+ initalize_FileList $fileList_Pane $projectPath $projectFiles $editor_sw_lock
- # Adjust progress dialog invoked from procedure initiate_FileList
+ # Adjust progress dialog
catch {.prgDl configure -command {puts stderr "Unable to abort at this stage !"}}
- set ::FileList::open_files_cur_file {Finishing ...}
+ set ::FileList::open_files_cur_file [mc "Finishing ..."]
# Pack main pane
pack $main_Pane -expand 1 -fill both
# Raise last tab in mainNB
- .mainFrame.mainNB raise [string trimleft $this {:}]
+ ${::main_nb} raise [string trimleft $this {:}]
# Take care of proper geometry management
bottomNB_redraw_pane
@@ -272,6 +297,7 @@ class MainTab {
# Load scenario file
if {[pale_open_scenario $scenario_file] == 1} {
tk_messageBox \
+ -parent . \
-type ok \
-icon error \
-title [mc "IO Error"] \
@@ -287,7 +313,7 @@ class MainTab {
## Object destructor
destructor {
- .mainFrame.mainNB delete [string trimleft $this {:}]
+ ${::main_nb} delete [string trimleft $this {:}]
}
## Kill all child processes
@@ -298,10 +324,10 @@ class MainTab {
$this hw_man_kill_childern
}
- ## Refresh list of avaliable SFR and SFB
+ ## Refresh list of available SFR and SFB
# @return void
- public method refresh_project_avaliable_SFR {} {
- set avaliable_SFR [concat [lindex $procData 43] {
+ public method refresh_project_available_SFR {} {
+ set available_SFR [concat [lindex $procData 43] {
R0 R1 R2 R3 R4 R5 R6 R7
B ACC A TMOD TH0 TH1 SP DPL DPH PCON
TL0 TL1 AB DPTR
@@ -314,7 +340,7 @@ class MainTab {
}] ;# REGISTER BIT 7 BIT 6 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 BIT 0
foreach editor [$this cget -editors] {
- $editor refresh_avaliable_SFR
+ $editor refresh_available_SFR
}
}
@@ -362,9 +388,9 @@ class MainTab {
# @return void
public method retrieve_compiler_settings {} {
# Native assembler
- foreach key ${::configDialogs::compiler::defaults} {
+ foreach key ${::configDialogues::compiler::defaults} {
set key [lindex $key 0]
- set PCC_native_assembler($key) [subst "\$::Compiler::Settings::$key"]
+ set PCC_native_assembler($key) [subst -nocommands "\$::Compiler::Settings::$key"]
}
set PCC_native_assembler(WARNING_LEVEL) \
${::Compiler::Settings::WARNING_LEVEL}
@@ -422,4 +448,16 @@ class MainTab {
[array get PCC_AS31_addcfg] \
]
}
+
+ ## Set project read only flag
+ #
+ # The flag inhibits proc ::X::__proj_save.
+ # @return void
+ public method set_read_only {} {
+ set S_flag_read_only 1
+ }
+}
+
+# >>> File inclusion guard
}
+# <<< File inclusion guard