summaryrefslogtreecommitdiff
path: root/lib/utilities/speccalc.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utilities/speccalc.tcl')
-rw-r--r--[-rwxr-xr-x]lib/utilities/speccalc.tcl611
1 files changed, 339 insertions, 272 deletions
diff --git a/lib/utilities/speccalc.tcl b/lib/utilities/speccalc.tcl
index 67a9430..49db83b 100755..100644
--- a/lib/utilities/speccalc.tcl
+++ b/lib/utilities/speccalc.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 _SPECCALC_TCL ] } {
+set _SPECCALC_TCL _
+# <<< File inclusion guard
+
# --------------------------------------------------------------------------
# DESCRIPTION
@@ -34,7 +39,7 @@
class SpecCalc {
## COMMON
common count 0 ;# Int: Counter of class instances
- common diagram_counter 0 ;# Int: Counter of diagram dialogs instances
+ common diagram_counter 0 ;# Int: Counter of diagram dialogues instances
# List of pages descriptors for PagesManager
common page_list {
loops timer01 timer2 spi
@@ -67,10 +72,10 @@ class SpecCalc {
ttk::style configure SpecCalc_RedBg.TCombobox -fieldbackground {#FFCCCC}
ttk::style configure SpecCalc_Flat.TButton -background {#FFFFFF} -padding 0 -borderwidth 1 -relief flat
- ttk::style map SpecCalc_Flat.TButton -relief [list active raised] -background [list disabled {#EEEEEE} active {#EEEEFF}]
+ ttk::style map SpecCalc_Flat.TButton -relief [list active raised] -background [list disabled ${::COMMON_BG_COLOR} active {#EEEEFF}]
ttk::style configure SpecCalc_Spec.TButton -background {#CCCCFF} -padding 0
- ttk::style map SpecCalc_Spec.TButton -background [list disabled {#EEEEEE} active {#DDDDFF}]
+ ttk::style map SpecCalc_Spec.TButton -background [list disabled ${::COMMON_BG_COLOR} active {#DDDDFF}]
create_gui
}
@@ -86,7 +91,7 @@ class SpecCalc {
[list [$widgets(loops,time_ent) get] \
[$widgets(loops,time_cb) current] \
[$widgets(loops,clock_cb) get] \
- [$widgets(loops,clock_type_cb) current] \
+ [$widgets(loops,clock_type_cb) current] \
[$widgets(loops,reg_ent0) get] \
[$widgets(loops,reg_ent1) get] \
[$widgets(loops,reg_ent2) get] \
@@ -102,7 +107,7 @@ class SpecCalc {
[$widgets(timer01,clock_type_cb) current] \
[$widgets(timer01,mode_cb) current] \
[$widgets(timer01,psc_cb) current] \
- [subst "\${::SpecCalc::spec_chb_$obj_idx}"] \
+ [subst -nocommands "\${::SpecCalc::spec_chb_$obj_idx}"] \
] [list \
[$widgets(timer2,time_ent) get] \
[$widgets(timer2,time_cb) current] \
@@ -111,14 +116,14 @@ class SpecCalc {
[$widgets(timer2,mode_cb) current] \
] [list \
- [subst "\$::SpecCalc::timer2_clk_fosc_$obj_idx"]\
- [subst "\$::SpecCalc::timer2_clk_freq_$obj_idx"]\
- [subst "\$::SpecCalc::timer2_clk_x2_$obj_idx"] \
+ [subst -nocommands "\$::SpecCalc::timer2_clk_fosc_$obj_idx"] \
+ [subst -nocommands "\$::SpecCalc::timer2_clk_freq_$obj_idx"] \
+ [subst -nocommands "\$::SpecCalc::timer2_clk_x2_$obj_idx"] \
] [list \
[wm geometry $win] \
$active_page \
] [list \
- [subst "\${::SpecCalc::double_chb_$obj_idx}"] \
+ [subst -nocommands "\${::SpecCalc::double_chb_$obj_idx}"] \
[$widgets(spi,sck_ent00) get] \
]
]
@@ -148,7 +153,7 @@ class SpecCalc {
# @return void
private method create_gui {} {
# Create dialog window and the main frame
- set win [toplevel .spec_calc$count -class [mc "Special Calculator - MCU 8051 IDE"] -bg {#EEEEEE}]
+ set win [toplevel .spec_calc$count -class [mc "Special Calculator - MCU 8051 IDE"] -bg ${::COMMON_BG_COLOR}]
set main_frame [frame $win.main_frame]
# Create status bar
@@ -192,7 +197,7 @@ class SpecCalc {
if {[llength $config]} {
wm geometry $win [lindex $config {4 0}]
switch_page [lindex $config {4 1}]
- } {
+ } else {
wm geometry $win 400x350
switch_page loops
}
@@ -222,10 +227,10 @@ class SpecCalc {
} page $page_list \
{
set buttons($page) [ttk::button $target_frame.${page}_button \
- -image ::ICONS::22::$icon \
- -text [mc $name] -compound top \
- -command "$this switch_page $page" \
- -style Flat.TButton \
+ -image ::ICONS::22::$icon \
+ -text [mc $name] -compound top \
+ -command "$this switch_page $page" \
+ -style Flat.TButton \
]
pack $buttons($page) -anchor n
set_status_tip $buttons($page) [mc $stip]
@@ -236,7 +241,7 @@ class SpecCalc {
# @parm Widget target_frame - Frame widget in which the GUI should be created
# @return void
private method create_right_frame {target_frame} {
- set pages_manager [PagesManager $target_frame.pages_manager -background {#eeeeee}]
+ set pages_manager [PagesManager $target_frame.pages_manager -background ${::COMMON_BG_COLOR}]
pack $pages_manager -fill both -expand 1
foreach page $page_list {
@@ -363,13 +368,13 @@ class SpecCalc {
-command "$this calc loops copy_but {}" \
]
pack $widgets(loops,copy_but) -side right
- set widgets(loops,results) [text $bottom_frame_b.text \
- -state disabled -width 0 -height 0 -bg white \
- -yscrollcommand "$bottom_frame_b.scrollbar set" \
- -takefocus 1 -font [font create \
- -family $::DEFAULT_FIXED_FONT \
- -size -14 \
- ] \
+ set widgets(loops,results) [text $bottom_frame_b.text \
+ -state disabled -width 0 -height 0 -bg white \
+ -yscrollcommand "$bottom_frame_b.scrollbar set" \
+ -takefocus 1 -font [font create \
+ -family $::DEFAULT_FIXED_FONT \
+ -size [expr {int(-14 * $::font_size_factor)}] \
+ ] \
]
ASMsyntaxHighlight::create_tags $widgets(loops,results) 14 $::DEFAULT_FIXED_FONT
bind $widgets(loops,results) <Button-1> "focus %W"
@@ -394,13 +399,13 @@ class SpecCalc {
# Create page header
- pack [label $pages($page).header \
- -text [mc "Create a wait loop"] \
- -font [font create \
- -family {helvetica} \
- -size -17 \
- -weight bold \
- ] \
+ pack [label $pages($page).header \
+ -text [mc "Create a wait loop"] \
+ -font [font create \
+ -family {helvetica} \
+ -size [expr {int(-17 * $::font_size_factor)}] \
+ -weight bold \
+ ] \
] -pady 5
pack $top_frame -anchor nw
pack $regs_frame -anchor nw -fill x
@@ -413,15 +418,15 @@ class SpecCalc {
if {[llength $config]} {
$widgets(loops,time_ent) insert 0 [lindex $config {0 0}]
$widgets(loops,time_cb) current [lindex $config {0 1}]
- $widgets(loops,clock_cb) delete 0 end
- $widgets(loops,clock_cb) insert 0 [lindex $config {0 2}]
+ $widgets(loops,clock_cb) delete 0 end
+ $widgets(loops,clock_cb) insert 0 [lindex $config {0 2}]
$widgets(loops,clock_type_cb) current [lindex $config {0 3}]
for {set i 0; set k 4} {$i < 8} {incr i; incr k} {
$widgets(loops,reg_ent$i) insert 0 [lindex $config [list 0 $k]]
}
- } {
+ } else {
$widgets(loops,time_cb) current 1
$widgets(loops,clock_cb) current 2
$widgets(loops,clock_type_cb) current 0
@@ -569,9 +574,9 @@ class SpecCalc {
# - TH
set widgets(timer01,th) [ \
entry $bottom_frame.th_r_lbl -state readonly \
- -readonlybackground {#EEEEEE} \
+ -readonlybackground ${::COMMON_BG_COLOR} \
-disabledforeground {#000000} \
- -fg {#888888} -bg {#EEEEEE} \
+ -fg {#888888} -bg ${::COMMON_BG_COLOR} \
-relief flat -highlightthickness 0 -bd 0 \
-textvariable ::SpecCalc::timer01_th_$obj_idx \
]
@@ -580,8 +585,8 @@ class SpecCalc {
# - TL
set widgets(timer01,tl) [ \
entry $bottom_frame.tl_r_lbl -state readonly \
- -fg {#888888} -bg {#EEEEEE} \
- -readonlybackground {#EEEEEE} \
+ -fg {#888888} -bg ${::COMMON_BG_COLOR} \
+ -readonlybackground ${::COMMON_BG_COLOR} \
-disabledforeground {#000000} \
-relief flat -highlightthickness 0 -bd 0 \
-textvariable ::SpecCalc::timer01_tl_$obj_idx \
@@ -591,8 +596,8 @@ class SpecCalc {
# - RH
set widgets(timer01,rh) [ \
entry $bottom_frame.rh_r_lbl -state readonly \
- -fg {#888888} -bg {#EEEEEE} \
- -readonlybackground {#EEEEEE} \
+ -fg {#888888} -bg ${::COMMON_BG_COLOR} \
+ -readonlybackground ${::COMMON_BG_COLOR} \
-disabledforeground {#000000} \
-relief flat -highlightthickness 0 -bd 0 \
-textvariable ::SpecCalc::timer01_rh_$obj_idx \
@@ -601,8 +606,8 @@ class SpecCalc {
# - RL
set widgets(timer01,rl) [ \
entry $bottom_frame.rl_r_lbl -state readonly \
- -fg {#888888} -bg {#EEEEEE} \
- -readonlybackground {#EEEEEE} \
+ -fg {#888888} -bg ${::COMMON_BG_COLOR} \
+ -readonlybackground ${::COMMON_BG_COLOR} \
-disabledforeground {#000000} \
-relief flat -highlightthickness 0 -bd 0 \
-textvariable ::SpecCalc::timer01_rl_$obj_idx \
@@ -611,8 +616,8 @@ class SpecCalc {
# - Repeats
set widgets(timer01,repeats) [ \
entry $bottom_frame.reps_lbl -state readonly \
- -fg {#888888} -bg {#EEEEEE} \
- -readonlybackground {#EEEEEE} \
+ -fg {#888888} -bg ${::COMMON_BG_COLOR} \
+ -readonlybackground ${::COMMON_BG_COLOR} \
-disabledforeground {#000000} \
-relief flat -highlightthickness 0 -bd 0 \
-textvariable ::SpecCalc::timer01_repeats_$obj_idx\
@@ -622,8 +627,8 @@ class SpecCalc {
# - Rest
set widgets(timer01,rest) [ \
entry $bottom_frame.rest_r_lbl -state readonly \
- -fg {#888888} -bg {#EEEEEE} \
- -readonlybackground {#EEEEEE} \
+ -fg {#888888} -bg ${::COMMON_BG_COLOR} \
+ -readonlybackground ${::COMMON_BG_COLOR} \
-disabledforeground {#000000} \
-relief flat -highlightthickness 0 -bd 0 \
-textvariable ::SpecCalc::timer01_rest_$obj_idx \
@@ -636,13 +641,13 @@ class SpecCalc {
# Create page header
- pack [label $pages($page).header \
- -text [mc "Calculate timer 0/1 preset"] \
- -font [font create \
- -family {helvetica} \
- -size -17 \
- -weight bold \
- ] \
+ pack [label $pages($page).header \
+ -text [mc "Calculate timer 0/1 preset"] \
+ -font [font create \
+ -family {helvetica} \
+ -size [expr {int(-17 * $::font_size_factor)}] \
+ -weight bold \
+ ] \
] -pady 5
pack $top_frame -anchor nw
pack [ttk::separator $pages($page).sep \
@@ -682,7 +687,7 @@ class SpecCalc {
private method create_page_timer2 {} {
# Create notebook
set page {timer2}
- set nb [NoteBook $pages($page).nb -side top -arcradius 4 -bg {#EEEEEE}]
+ set nb [ModernNoteBook $pages($page).nb]
# - Page "Preset"
set preset_frame [$nb insert end {Preset} \
-text [mc "Preset"] \
@@ -805,10 +810,10 @@ class SpecCalc {
# - RCAL2H
set widgets(timer2,rcal2h) [
entry $bottom_frame.rcal2h_r_lbl -state readonly \
- -fg {#888888} -bg {#EEEEEE} \
+ -fg {#888888} -bg ${::COMMON_BG_COLOR} \
-relief flat -highlightthickness 0 -bd 0 \
-textvariable ::SpecCalc::timer2_rcal2h_$obj_idx \
- -readonlybackground {#EEEEEE} \
+ -readonlybackground ${::COMMON_BG_COLOR} \
-disabledforeground {#000000} \
]
set ::SpecCalc::timer2_rcal2h_$obj_idx [mc "Do not change"]
@@ -816,10 +821,10 @@ class SpecCalc {
# - RCAL2L
set widgets(timer2,rcal2l) [
entry $bottom_frame.rcal2l_r_lbl -state readonly \
- -fg {#888888} -bg {#EEEEEE} \
+ -fg {#888888} -bg ${::COMMON_BG_COLOR} \
-relief flat -highlightthickness 0 -bd 0 \
-textvariable ::SpecCalc::timer2_rcal2l_$obj_idx \
- -readonlybackground {#EEEEEE} \
+ -readonlybackground ${::COMMON_BG_COLOR} \
-disabledforeground {#000000} \
]
set ::SpecCalc::timer2_rcal2l_$obj_idx [mc "Do not change"]
@@ -827,10 +832,10 @@ class SpecCalc {
# - T2H
set widgets(timer2,t2h) [
entry $bottom_frame.t2h_r_lbl -state readonly \
- -fg {#888888} -bg {#EEEEEE} \
+ -fg {#888888} -bg ${::COMMON_BG_COLOR} \
-relief flat -highlightthickness 0 -bd 0 \
-textvariable ::SpecCalc::timer2_t2h_$obj_idx \
- -readonlybackground {#EEEEEE} \
+ -readonlybackground ${::COMMON_BG_COLOR} \
-disabledforeground {#000000} \
]
set ::SpecCalc::timer2_t2h_$obj_idx [mc "Do not change"]
@@ -838,21 +843,21 @@ class SpecCalc {
# - T2L
set widgets(timer2,t2l) [
entry $bottom_frame.t2l_r_lbl -state readonly \
- -fg {#888888} -bg {#EEEEEE} \
+ -fg {#888888} -bg ${::COMMON_BG_COLOR} \
-relief flat -highlightthickness 0 -bd 0 \
-textvariable ::SpecCalc::timer2_t2l_$obj_idx \
- -readonlybackground {#EEEEEE} \
+ -readonlybackground ${::COMMON_BG_COLOR} \
-disabledforeground {#000000} \
]
set ::SpecCalc::timer2_t2l_$obj_idx [mc "Do not change"]
grid $widgets(timer2,t2l) -row 4 -column 3 -sticky w
# - Repeats
- set widgets(timer2,repeats) [ \
- entry $bottom_frame.repeats_lbl -state readonly \
- -fg {#888888} -bg {#EEEEEE} \
- -relief flat -highlightthickness 0 -bd 0 \
- -readonlybackground {#EEEEEE} \
- -disabledforeground {#000000} \
+ set widgets(timer2,repeats) [ \
+ entry $bottom_frame.repeats_lbl -state readonly \
+ -fg {#888888} -bg ${::COMMON_BG_COLOR} \
+ -relief flat -highlightthickness 0 -bd 0 \
+ -readonlybackground ${::COMMON_BG_COLOR} \
+ -disabledforeground {#000000} \
-textvariable ::SpecCalc::timer2_repeats_$obj_idx \
]
set ::SpecCalc::timer2_repeats_$obj_idx [mc "none"]
@@ -860,9 +865,9 @@ class SpecCalc {
# - Rest
set widgets(timer2,rest) [ \
entry $bottom_frame.rest_r_lbl -state readonly \
- -fg {#888888} -bg {#EEEEEE} \
+ -fg {#888888} -bg ${::COMMON_BG_COLOR} \
-relief flat -highlightthickness 0 -bd 0 \
- -readonlybackground {#EEEEEE} \
+ -readonlybackground ${::COMMON_BG_COLOR} \
-disabledforeground {#000000} \
-textvariable ::SpecCalc::timer2_rest_$obj_idx \
]
@@ -874,13 +879,13 @@ class SpecCalc {
# Create page header
- pack [label $preset_frame.header \
- -text [mc "Calculate timer 2 preset"] \
- -font [font create \
- -family {helvetica} \
- -size -17 \
- -weight bold \
- ] \
+ pack [label $preset_frame.header \
+ -text [mc "Calculate timer 2 preset"] \
+ -font [font create \
+ -family {helvetica} \
+ -size [expr {int(-17 * $::font_size_factor)}] \
+ -weight bold \
+ ] \
] -pady 5
pack $top_frame -pady 5 -anchor nw
pack [ttk::separator $preset_frame.sep \
@@ -892,11 +897,11 @@ class SpecCalc {
if {[llength $config]} {
$widgets(timer2,time_ent) insert 0 [lindex $config {2 0}]
$widgets(timer2,time_cb) current [lindex $config {2 1}]
- $widgets(timer2,clock_cb) delete 0 end
- $widgets(timer2,clock_cb) insert 0 [lindex $config {1 2}]
+ $widgets(timer2,clock_cb) delete 0 end
+ $widgets(timer2,clock_cb) insert 0 [lindex $config {1 2}]
$widgets(timer2,clock_type_cb) current [lindex $config {2 3}]
$widgets(timer2,mode_cb) current [lindex $config {2 4}]
- } {
+ } else {
$widgets(timer2,time_cb) current 1
$widgets(timer2,clock_cb) current 2
$widgets(timer2,clock_type_cb) current 0
@@ -972,10 +977,10 @@ class SpecCalc {
# - RCAL2H
set widgets(timer2,clk_rcal2h) [
entry $bottom_frame.clk_rcal2h_r_lbl -state readonly \
- -fg {#888888} -bg {#EEEEEE} -validate key \
+ -fg {#888888} -bg ${::COMMON_BG_COLOR} -validate key \
-relief flat -highlightthickness 0 -bd 0 -width 5 \
-textvariable ::SpecCalc::timer2_clk_rcal2h_$obj_idx \
- -readonlybackground {#EEEEEE} \
+ -readonlybackground ${::COMMON_BG_COLOR} \
-disabledforeground {#000000} \
]
set ::SpecCalc::timer2_clk_rcal2h_$obj_idx "--"
@@ -983,10 +988,10 @@ class SpecCalc {
# - RCAL2L
set widgets(timer2,clk_rcal2l) [
entry $bottom_frame.clk_rcal2l_r_lbl -state readonly \
- -fg {#888888} -bg {#EEEEEE} -validate key \
+ -fg {#888888} -bg ${::COMMON_BG_COLOR} -validate key \
-relief flat -highlightthickness 0 -bd 0 -width 5 \
-textvariable ::SpecCalc::timer2_clk_rcal2l_$obj_idx \
- -readonlybackground {#EEEEEE} \
+ -readonlybackground ${::COMMON_BG_COLOR} \
-disabledforeground {#000000} \
]
set ::SpecCalc::timer2_clk_rcal2l_$obj_idx "--"
@@ -994,10 +999,10 @@ class SpecCalc {
# RCAL2H
set widgets(timer2,clk_rcal2h_d) [
entry $bottom_frame.clk_rcal2h_d_r_lbl -state readonly \
- -fg {#888888} -bg {#EEEEEE} -validate key \
+ -fg {#888888} -bg ${::COMMON_BG_COLOR} -validate key \
-relief flat -highlightthickness 0 -bd 0 -width 5 \
-textvariable ::SpecCalc::timer2_clk_rcal2h_d_$obj_idx \
- -readonlybackground {#EEEEEE} \
+ -readonlybackground ${::COMMON_BG_COLOR} \
-disabledforeground {#000000} \
]
set ::SpecCalc::timer2_clk_rcal2h_d_$obj_idx "--"
@@ -1005,10 +1010,10 @@ class SpecCalc {
# - RCAL2L
set widgets(timer2,clk_rcal2l_d) [
entry $bottom_frame.clk_rcal2l_d_r_lbl -state readonly \
- -fg {#888888} -bg {#EEEEEE} -validate key \
+ -fg {#888888} -bg ${::COMMON_BG_COLOR} -validate key \
-relief flat -highlightthickness 0 -bd 0 -width 5 \
-textvariable ::SpecCalc::timer2_clk_rcal2l_d_$obj_idx \
- -readonlybackground {#EEEEEE} \
+ -readonlybackground ${::COMMON_BG_COLOR} \
-disabledforeground {#000000} \
]
set ::SpecCalc::timer2_clk_rcal2l_d_$obj_idx "--"
@@ -1016,10 +1021,10 @@ class SpecCalc {
# - Error
set widgets(timer2,clk_error) [
entry $bottom_frame.clk_error_r_lbl -state readonly \
- -fg {#888888} -bg {#EEEEEE} -validate key \
+ -fg {#888888} -bg ${::COMMON_BG_COLOR} -validate key \
-relief flat -highlightthickness 0 -bd 0 -width 12 \
-textvariable ::SpecCalc::timer2_clk_error_$obj_idx \
- -readonlybackground {#EEEEEE} \
+ -readonlybackground ${::COMMON_BG_COLOR} \
-disabledforeground {#000000} \
]
set ::SpecCalc::timer2_clk_error_$obj_idx "--"
@@ -1033,30 +1038,30 @@ class SpecCalc {
set ::SpecCalc::timer2_clk_fosc_$obj_idx [lindex $config {3 0}]
set ::SpecCalc::timer2_clk_freq_$obj_idx [lindex $config {3 1}]
set ::SpecCalc::timer2_clk_x2_$obj_idx [lindex $config {3 2}]
- } {
+ } else {
set ::SpecCalc::timer2_clk_fosc_$obj_idx {}
set ::SpecCalc::timer2_clk_freq_$obj_idx {}
set ::SpecCalc::timer2_clk_x2_$obj_idx {0}
}
# Create page header
- pack [label $clock_out_frame.header \
- -text [mc "Calculate clock output"] \
- -font [font create \
- -family {helvetica} \
- -size -17 \
- -weight bold \
- ] \
+ pack [label $clock_out_frame.header \
+ -text [mc "Calculate clock output"] \
+ -font [font create \
+ -family {helvetica} \
+ -size [expr {int(-17 * $::font_size_factor)}] \
+ -weight bold \
+ ] \
] -pady 5
- pack [label $clock_out_frame.math \
- -image [image create photo \
- -format png \
- -file "${::LIB_DIRNAME}/../icons/other/math0.png" \
- ] \
+ pack [label $clock_out_frame.math \
+ -image [image create photo \
+ -format png \
+ -file "${::ROOT_DIRNAME}/icons/other/math0.png" \
+ ] \
] -pady 5
pack $bottom_frame -anchor nw
$nb raise {Preset}
- pack $nb -fill both -expand 1
+ pack [$nb get_nb] -fill both -expand 1
}
## Create page for calculating SPI related values
@@ -1102,10 +1107,10 @@ class SpecCalc {
grid $widgets(spi,sck_ent00) -row 2 -column 2
grid [label $top_frame.spr1_1_lbl \
- -text "0" \
+ -text "0" \
] -row 3 -column 0
grid [label $top_frame.spr0_1_lbl \
- -text "1" \
+ -text "1" \
] -row 3 -column 1
set widgets(spi,sck_ent01) [ttk::entry $top_frame.sck_1_ent \
-width 9 \
@@ -1115,10 +1120,10 @@ class SpecCalc {
grid $widgets(spi,sck_ent01) -row 3 -column 2
grid [label $top_frame.spr1_2_lbl \
- -text "1" \
+ -text "1" \
] -row 4 -column 0
grid [label $top_frame.spr0_2_lbl \
- -text "0" \
+ -text "0" \
] -row 4 -column 1
set widgets(spi,sck_ent10) [ttk::entry $top_frame.sck_2_ent \
-width 9 \
@@ -1128,10 +1133,10 @@ class SpecCalc {
grid $widgets(spi,sck_ent10) -row 4 -column 2
grid [label $top_frame.spr1_3_lbl \
- -text "1" \
+ -text "1" \
] -row 5 -column 0
grid [label $top_frame.spr0_3_lbl \
- -text "1" \
+ -text "1" \
] -row 5 -column 1
set widgets(spi,sck_ent11) [ttk::entry $top_frame.sck_3_ent \
-width 9 \
@@ -1144,26 +1149,26 @@ class SpecCalc {
pack [label $bottom_frame.res_lbl0 \
-text [mc "Set MCU oscillator to "] \
] -side left
- set widgets(spi,result) [ \
- entry $bottom_frame.result_ent \
- -readonlybackground {#EEEEEE} \
- -disabledforeground {#000000} \
- -bg {#EEEEEE} -width 0 -bd 1 -state readonly \
- -relief flat -highlightthickness 0 \
- -textvariable ::SpecCalc::spi_result_$obj_idx \
+ set widgets(spi,result) [ \
+ entry $bottom_frame.result_ent \
+ -readonlybackground ${::COMMON_BG_COLOR} \
+ -disabledforeground {#000000} \
+ -bg ${::COMMON_BG_COLOR} -width 0 -bd 1 -state readonly \
+ -relief flat -highlightthickness 0 \
+ -textvariable ::SpecCalc::spi_result_$obj_idx \
]
pack $widgets(spi,result) -side left
pack [label $bottom_frame.res_lbl1 \
- -text [mc " kHz"] \
+ -text [mc " kHz"] \
] -side left
- pack [label $pages($page).header \
- -text [mc "Calculate oscillator frequency"] \
- -font [font create \
- -family {helvetica} \
- -size -17 \
- -weight bold \
- ] \
+ pack [label $pages($page).header \
+ -text [mc "Calculate oscillator frequency"] \
+ -font [font create \
+ -family {helvetica} \
+ -size [expr {int(-17 * $::font_size_factor)}] \
+ -weight bold \
+ ] \
] -pady 5
pack $top_frame -pady 5 -anchor nw
pack [ttk::separator $pages($page).sep \
@@ -1205,7 +1210,7 @@ class SpecCalc {
}
}
- ## Auxiliary procedure for procedure "calculate_loops"
+ ## Auxiliary function for function "calculate_loops"
# @parm float time
# @parm float rest
# @parm Bool is_spec
@@ -1239,7 +1244,7 @@ class SpecCalc {
set time [expr {$time / $div}]
if {$res($len) == 256} {
set res($len) 0
- } {
+ } else {
set res($len) $div
}
@@ -1250,7 +1255,7 @@ class SpecCalc {
incr len
if {$len > 1} {
incr res(0) -2
- } {
+ } else {
incr res(0) -1
}
set correction 0
@@ -1266,13 +1271,13 @@ class SpecCalc {
if {$i == 1} {
if {[lindex $is_spec $i]} {
set correction 1
- } {
+ } else {
set correction 2
}
- } {
+ } else {
if {[lindex $is_spec $i]} {
set correction [expr {($correction * $res($i)) + ($res($i) * 2) + 1}]
- } {
+ } else {
set correction [expr {($correction * $res($i)) + ($res($i) * 3) + 2}]
}
}
@@ -1282,10 +1287,126 @@ class SpecCalc {
return [list $rest $len [array get res]]
}
- ## Report an error occured during evaluation of the wait loop
- # @return void
- private method calculate_loops_evaluation_error {} {
- error "Please report this bug. Method ::SpecCalc::calculate_loops --> Evaluation error. Dump: \n\$widgets(loops,time_ent) == $widgets(loops,time_ent)\n\$widgets(loops,time_cb) == $widgets(loops,time_cb)\n\$widgets(loops,clock_cb) == $widgets(loops,clock_cb)\n\$widgets(loops,clock_type_cb) == $widgets(loops,clock_type_cb)\n\$widgets(loops,reg_ent0) == $widgets(loops,reg_ent0)\n\$widgets(loops,reg_ent1) == $widgets(loops,reg_ent1)\n\$widgets(loops,reg_ent2) == $widgets(loops,reg_ent2)\n\$widgets(loops,reg_ent3) == $widgets(loops,reg_ent3)\n\$widgets(loops,reg_ent4) == $widgets(loops,reg_ent4)\n\$widgets(loops,reg_ent5) == $widgets(loops,reg_ent5)\n\$widgets(loops,reg_ent6) == $widgets(loops,reg_ent6)\n\$widgets(loops,reg_ent7) == $widgets(loops,reg_ent7)"
+ private method calculate_loops_AUX2 {time clock is_spec} {
+ set time_org $time
+ set i 0
+ set result [list]
+ set lowest_rest {}
+ set last_rest {}
+ set result_c {}
+ set result_fin_i 0
+ for {set i 0} {$i < 8} {incr i} {
+ set rest $time_org
+ set time [expr {int($time)}]
+ set rest [expr {$rest - $time}]
+
+ if {!$i && $time_org < 2.0} {
+ lappend result [list [expr {$time_org * 2.0 + 1.0}] 0 [list 0 {} 1 {} 2 {} 3 {} 4 {} 5 {} 6 {} 7 {}]]
+ break
+ }
+
+ set result_c [calculate_loops_AUX $time $rest $is_spec]
+ if {$result_c == {0}} {
+ return {}
+ }
+ lappend result $result_c
+
+ if {$lowest_rest == {}} {
+ set lowest_rest [lindex $result_c 0]
+
+ } elseif {$lowest_rest < 0} {
+ if {
+ ( [lindex $result_c 0] >= 0 )
+ ||
+ ( abs($lowest_rest) > abs([lindex $result_c 0]) )
+ } then {
+ set result_fin_i $i
+ set lowest_rest [lindex $result_c 0]
+ }
+
+ } elseif {
+ ( [lindex $result_c 0] >= 0 )
+ &&
+ ( $lowest_rest > [lindex $result_c 0] )
+ } then {
+ set result_fin_i $i
+ set lowest_rest [lindex $result_c 0]
+ }
+
+ if {$last_rest == [lindex $result_c 0] || ![lindex $result_c 0]} {
+ break
+ }
+ set last_rest [lindex $result_c 0]
+ set time [expr {$time_org + ($last_rest / 2.0)}]
+ }
+
+ return [lindex $result $result_fin_i]
+ }
+
+ private method calculate_loops_AUX3 {len is_spec res_list reg_list} {
+ set e_no_of_spaces ${::Editor::number_of_spaces}
+ if {$e_no_of_spaces == 1} {
+ set e_no_of_spaces 5
+ } elseif {$e_no_of_spaces <= 4} {
+ set e_no_of_spaces 6
+ }
+
+ array set res $res_list
+ array set reg $reg_list
+ set last_branch 0
+ set branch 0
+ for {set i 0} {$i < $len} {incr i} {
+ set branch $last_branch
+ set val $res($i)
+
+ set val [string range [format {%X} $res($i)] end-1 end]
+ set val "[string repeat {0} [expr {3 - [string length $val]}]]$val"
+
+ set cmp {}
+ if {[lindex $is_spec $i]} {
+ if {!$i} {
+ if {${::Editor::spaces_no_tabs}} {
+ set cmp "\n[string repeat { } ${::Editor::number_of_spaces}]NOP"
+ } else {
+ set cmp "\n\tNOP"
+ }
+ incr branch 1
+ }
+ } else {
+ incr branch 2
+ }
+ incr branch 4
+
+ set last_branch $branch
+ if {!$i} {
+ set branch 0
+ incr last_branch -4
+ }
+
+ if {$branch == {0}} {
+ set branch {}
+ } else {
+ set branch "-$branch"
+ }
+
+ if {${::Editor::spaces_no_tabs}} {
+ set res($i) [list \
+ "[string repeat { } ${::Editor::number_of_spaces}]DJNZ[string repeat { } [expr {$e_no_of_spaces - 4}]]$reg($i), \$$branch" \
+ "[string repeat { } ${::Editor::number_of_spaces}]MOV[string repeat { } [expr {$e_no_of_spaces - 3}]]$reg($i), #${val}h$cmp" \
+ ]
+ } else {
+ set res($i) [list \
+ "\tDJNZ\t$reg($i), \$$branch" \
+ "\tMOV\t$reg($i), #${val}h$cmp" \
+ ]
+ }
+ }
+ for {set i [expr {$len - 1}]} {$i >= 0} {incr i -1} {
+ $widgets(loops,results) insert end "[lindex $res($i) 1]\n"
+ }
+ for {set i 0} {$i < $len} {incr i} {
+ $widgets(loops,results) insert end "[lindex $res($i) 0]\n"
+ }
}
## Generate wait loop acoring to specified criteria
@@ -1302,7 +1423,7 @@ class SpecCalc {
if {[lsearch -ascii -exact {R0 R1 R2 R3 R4 R5 R6 R7 A} [string toupper $reg($i)]] != -1} {
lappend is_spec 1
- } {
+ } else {
lappend is_spec 0
}
}
@@ -1329,52 +1450,28 @@ class SpecCalc {
return 0
}
+ set e_no_of_spaces ${::Editor::number_of_spaces}
+ if {$e_no_of_spaces == 1} {
+ set e_no_of_spaces 5
+ } elseif {$e_no_of_spaces <= 4} {
+ set e_no_of_spaces 6
+ }
+
set time [expr {$time * [lindex {1.0 1000.0 1000000.0 1000000000.0} [$widgets(loops,time_cb) current]] / 2.0}]
- set clock [expr {[lindex {12.0 6.0 1.0} [$widgets(loops,clock_type_cb) current]] / $clock}]
+ set clock [expr {$clock / [lindex {12000000.0 6000000.0 1000000.0} [$widgets(loops,clock_type_cb) current]]}]
set time [expr {$time * $clock}]
- set time_org $time
- set i 0
- set result [list]
- set lowes_rest $time
- set last_rest {}
- set result_c {}
- set result_fin_i 0
- for {set i 0} {$i < 8} {incr i} {
-
- set rest $time_org
- set time [expr {int($time)}]
- set rest [expr {$rest - $time}]
-
- set result_c [calculate_loops_AUX $time $rest $is_spec]
- if {$result_c == {0}} {
- return 0
- }
- lappend result $result_c
-
- if {$lowes_rest == {}} {
- set lowes_rest [lindex $result_c 0]
-
- } elseif {($lowes_rest < 0) && ([lindex $result_c 0] >= 0)} {
- set result_fin_i $i
- set lowes_rest [lindex $result_c 0]
-
- } elseif {abs($lowes_rest) > abs([lindex $result_c 0])} {
- set result_fin_i $i
- set lowes_rest [lindex $result_c 0]
- }
-
- if {$last_rest == [lindex $result_c 0] || ![lindex $result_c 0]} {
- break
- }
- set last_rest [lindex $result_c 0]
- set time [expr {$time_org + ($last_rest / 2.0)}]
+ if {$time <= 258.5} {
+ set time [expr {$time - 0.5}]
}
- set time $time_org
- set rest [lindex $result [list $result_fin_i 0]]
- set len [lindex $result [list $result_fin_i 1]]
- array set res [lindex $result [list $result_fin_i 2]]
+ set final_results [calculate_loops_AUX2 $time $clock $is_spec]
+ if {$final_results == {}} {
+ return 0
+ }
+ set rest [lindex $final_results 0]
+ set len [lindex $final_results 1]
+ array set res [lindex $final_results 2]
for {set i 0} {$i < $len} {incr i} {
set error 0
@@ -1402,87 +1499,62 @@ class SpecCalc {
}
$widgets(loops,results) insert end "\n"
- set last_branch 0
- set branch 0
- for {set i 0} {$i < $len} {incr i} {
- set branch $last_branch
- set val $res($i)
-
- set val [string range [format {%X} $res($i)] end-1 end]
- set val "[string repeat {0} [expr {3 - [string length $val]}]]$val"
-
- set cmp {}
- if {[lindex $is_spec $i]} {
- if {!$i} {
- set cmp "\n\tNOP"
- incr branch 1
- }
- } {
- incr branch 2
- }
- incr branch 4
+ calculate_loops_AUX3 $len $is_spec [array get res] [array get reg]
- set last_branch $branch
- if {!$i} {
- set branch 0
- incr last_branch -4
- }
- if {$branch == {0}} {
- set branch {}
- } {
- set branch "-$branch"
+ while {$rest > 514} {
+ set final_results [calculate_loops_AUX2 [expr {$rest / 2.0}] $clock $is_spec]
+ if {$final_results == {}} {
+ return 0
}
-
- set res($i) [list \
- "\tDJNZ\t$reg($i), \$$branch" \
- "\tMOV\t$reg($i), #${val}h$cmp" \
- ]
- }
-
- for {set i [expr {$len - 1}]} {$i >= 0} {incr i -1} {
- $widgets(loops,results) insert end "[lindex $res($i) 1]\n"
- }
-
- for {set i 0} {$i < $len} {incr i} {
- $widgets(loops,results) insert end "[lindex $res($i) 0]\n"
+ set rest [lindex $final_results 0]
+ calculate_loops_AUX3 [lindex $final_results 1] $is_spec [lindex $final_results 2] [array get reg]
}
if {$rest <= 4} {
for {set i 0} {$i < 5} {incr i} {
- if {int(ceil($rest)) > 0.5} {
- $widgets(loops,results) insert end "\tNOP\n"
+ if {int(ceil($rest)) >= 0.5} {
+ if {${::Editor::spaces_no_tabs}} {
+ $widgets(loops,results) insert end "[string repeat { } ${::Editor::number_of_spaces}]NOP\n"
+ } else {
+ $widgets(loops,results) insert end "\tNOP\n"
+ }
set rest [expr {$rest - 1}]
}
}
- } {
+ } else {
if {[lindex $is_spec 0]} {
set rest [expr {$rest - 1}]
- } {
+ } else {
set rest [expr {$rest - 2}]
}
set val [expr {int($rest / 2)}]
set rest [expr {$rest - ($val * 2.0)}]
if {$val == 256} {
set val 0
- } elseif {$val > 256} {
- status_tip [mc "Unable to evaluate"]
- calculate_loops_clear_results
- return 0
}
+
set val [string range [format {%X} $val] end-1 end]
set val "[string repeat {0} [expr {3 - [string length $val]}]]$val"
- $widgets(loops,results) insert end "\tMOV\t$reg(0), #${val}h\n"
- $widgets(loops,results) insert end "\tDJNZ\t$reg(0), \$\n"
- if {int(ceil($rest)) > 0.5} {
- $widgets(loops,results) insert end "\tNOP\n"
- set rest [expr {$rest - 1}]
+ if {${::Editor::spaces_no_tabs}} {
+ $widgets(loops,results) insert end "[string repeat { } ${::Editor::number_of_spaces}]MOV[string repeat { } [expr {$e_no_of_spaces - 3}]]$reg(0), #${val}h\n"
+ $widgets(loops,results) insert end "[string repeat { } ${::Editor::number_of_spaces}]DJNZ[string repeat { } [expr {$e_no_of_spaces - 4}]]$reg(0), \$\n"
+ if {int(ceil($rest)) >= 0.5} {
+ $widgets(loops,results) insert end "[string repeat { } ${::Editor::number_of_spaces}]NOP\n"
+ set rest [expr {$rest - 1}]
+ }
+ } else {
+ $widgets(loops,results) insert end "\tMOV\t$reg(0), #${val}h\n"
+ $widgets(loops,results) insert end "\tDJNZ\t$reg(0), \$\n"
+ if {int(ceil($rest)) >= 0.5} {
+ $widgets(loops,results) insert end "\tNOP\n"
+ set rest [expr {$rest - 1}]
+ }
}
}
set rest [expr {$rest * 1.0 / $clock}]
$widgets(loops,results) insert end [mc "; Rest: %s\n" [adjust_rest $rest]]
-
$widgets(loops,results) insert end [mc "; END: Wait loop"]
set end [expr {int([$widgets(loops,results) index end])}]
@@ -1510,7 +1582,7 @@ class SpecCalc {
private method calculate_loops_enable_copy {enable} {
if {$enable} {
set enable {normal}
- } {
+ } else {
set enable {disabled}
}
$widgets(loops,copy_but) configure -state $enable
@@ -1521,13 +1593,11 @@ class SpecCalc {
public method calculate_timer01 {} {
set time [$widgets(timer01,time_ent) get]
if {$time == {} || $time == 0} {
- status_tip [mc "Invalid time"]
return 0
}
set clock [$widgets(timer01,clock_cb) get]
if {$clock == {} || $clock == 0} {
- status_tip [mc "Invalid clock rate"]
return 0
}
status_tip ""
@@ -1544,11 +1614,11 @@ class SpecCalc {
}
set time [expr {$time * [lindex {1.0 1000.0 1000000.0 1000000000.0} [$widgets(timer01,time_cb) current]]}]
- set clock [expr {[lindex {12.0 6.0 1.0} [$widgets(timer01,clock_type_cb) current]] / $clock}]
+ set clock [expr {$clock / [lindex {12000000.0 6000000.0 1000000.0} [$widgets(timer01,clock_type_cb) current]]}]
set time [expr {$time * $clock}]
set time_int [expr {int($time)}]
- set enhanced [subst "\$::SpecCalc::spec_chb_$obj_idx"]
+ set enhanced [subst -nocommands "\$::SpecCalc::spec_chb_$obj_idx"]
set prescaler [$widgets(timer01,psc_cb) current]
# Set default results
@@ -1561,7 +1631,7 @@ class SpecCalc {
{0} { ;# 9 -> 16 bit counter
if {$enhanced} {
set bits [expr {$prescaler + 9}]
- } {
+ } else {
set bits 13
}
set capacity [expr {1 << $bits}]
@@ -1574,7 +1644,7 @@ class SpecCalc {
if {[expr {!($time_int & $full_mask)}]} {
incr repeats -1
set stepsPerIter $full_mask
- } {
+ } else {
set stepsPerIter [expr {$time_int / $repeats}]
set tmp [expr {$capacity - $stepsPerIter}]
set low [expr {$tmp & $low_mask}]
@@ -1592,7 +1662,6 @@ class SpecCalc {
set rest [adjust_rest $rest]
if {$repeats > 1} {
- status_tip [mc "Value is too high"]
return 0
}
@@ -1619,7 +1688,7 @@ class SpecCalc {
incr repeats -1
set stepsPerIter 0xFFFF
set tmp 0
- } {
+ } else {
set stepsPerIter [expr {$time_int / $repeats}]
set tmp [expr {0x10000 - $stepsPerIter}]
set low [expr {$tmp & 0xFF}]
@@ -1637,7 +1706,7 @@ class SpecCalc {
if {$tmp < 0} {
set rest [expr {abs($tmp)}]
set tmp 0
- } {
+ } else {
set rest 0
}
set tmp [expr {$tmp & 0x0FFFF}]
@@ -1666,7 +1735,7 @@ class SpecCalc {
foreach w {rh rl tl th rest repeats} {
$widgets(timer01,$w) configure -fg {#000000}
}
- } {
+ } else {
if {$repeats > 1} {
status_tip [mc "Value is too high"]
return 0
@@ -1688,7 +1757,7 @@ class SpecCalc {
if {[expr {!($time_int & 0xFF)}]} {
incr repeats -1
set stepsPerIter 0xFF
- } {
+ } else {
set stepsPerIter [expr {$time_int / $repeats}]
set low [expr {0x100 - $stepsPerIter}]
set high $low
@@ -1705,7 +1774,7 @@ class SpecCalc {
if {$low < 0} {
set rest [expr {abs($low)}]
set low 0
- } {
+ } else {
set rest 0
}
@@ -1736,13 +1805,11 @@ class SpecCalc {
public method calculate_timer2 {} {
set time [$widgets(timer2,time_ent) get]
if {$time == {} || $time == 0} {
- status_tip [mc "Invalid time"]
return 0
}
set clock [$widgets(timer2,clock_cb) get]
if {$clock == {} || $clock == 0} {
- status_tip [mc "Invalid clock rate"]
return 0
}
status_tip ""
@@ -1759,7 +1826,7 @@ class SpecCalc {
}
set time [expr {$time * [lindex {1.0 1000.0 1000000.0 1000000000.0} [$widgets(timer2,time_cb) current]]}]
- set clock [expr {[lindex {12.0 6.0 1.0} [$widgets(timer2,clock_type_cb) current]] / $clock}]
+ set clock [expr {$clock / [lindex {12000000.0 6000000.0 1000000.0} [$widgets(timer2,clock_type_cb) current]]}]
set time [expr {$time * $clock}]
set time_int [expr {int($time)}]
set mode [$widgets(timer2,mode_cb) current]
@@ -1781,13 +1848,13 @@ class SpecCalc {
set low_p $low
set high_p $high
- } {
+ } else {
# Calculate tempotary results
if {[expr {!($time_int & 0xFFFF)}]} {
incr repeats -1
set stepsPerIter 0xFFFF
set tmp 0
- } {
+ } else {
set stepsPerIter [expr {$time_int / $repeats}]
set tmp [expr {0x10000 - $stepsPerIter}]
set rest [expr {$time_int - ((0x10000 - $tmp) * $repeats)}]
@@ -1805,7 +1872,7 @@ class SpecCalc {
if {$tmp < 0} {
set rest [expr {abs($tmp)}]
set tmp 0
- } {
+ } else {
set rest 0
}
set tmp [expr {$tmp & 0x0FFFF}]
@@ -1911,9 +1978,9 @@ class SpecCalc {
## Perform calculation intented for page "Timer 2 clock output"
# @return void
public method calculate_timer2_clk {} {
- set o [subst "\$::SpecCalc::timer2_clk_fosc_$obj_idx"]
- set f [subst "\$::SpecCalc::timer2_clk_freq_$obj_idx"]
- set x [subst "\$::SpecCalc::timer2_clk_x2_$obj_idx"]
+ set o [subst -nocommands "\$::SpecCalc::timer2_clk_fosc_$obj_idx"]
+ set f [subst -nocommands "\$::SpecCalc::timer2_clk_freq_$obj_idx"]
+ set x [subst -nocommands "\$::SpecCalc::timer2_clk_x2_$obj_idx"]
if {
![string length $o] || ![string length $f] || ![string length $x] ||
$f == 0 || $o == 0
@@ -1950,7 +2017,7 @@ class SpecCalc {
# @parm
# @return void
private method calculate_spi {type value} {
- set const [subst "\$::SpecCalc::double_chb_$obj_idx"]
+ set const [subst -nocommands "\$::SpecCalc::double_chb_$obj_idx"]
switch -- $type {
{sck_ent00} {
@@ -2085,14 +2152,10 @@ class SpecCalc {
return 1
}
{compute_but} {
- if {[catch {
- if {[calculate_loops]} {
- calculate_loops_enable_copy 1
- } {
- calculate_loops_enable_copy 0
- }
- }]} {
- calculate_loops_evaluation_error
+ if {[calculate_loops]} {
+ calculate_loops_enable_copy 1
+ } else {
+ calculate_loops_enable_copy 0
}
}
{copy_but} {
@@ -2160,7 +2223,7 @@ class SpecCalc {
grid $widgets(timer01,rl) -row 4 -column 3 -sticky w
grid $widgets(timer01,eq3) -row 3 -column 2
grid $widgets(timer01,eq4) -row 4 -column 2
- } {
+ } else {
grid forget $widgets(timer01,psc_lbl)
grid forget $widgets(timer01,psc_cb)
grid forget $widgets(timer01,rh_l)
@@ -2327,25 +2390,25 @@ class SpecCalc {
switch -- [$widgets(timer01,mode_cb) current] {
0 {
set title [mc "Timer 0/1 in mode 0"]
- if {[subst "\${::SpecCalc::spec_chb_$obj_idx}"]} {
+ if {[subst -nocommands "\${::SpecCalc::spec_chb_$obj_idx}"]} {
set image {timer_01_0e}
- } {
+ } else {
set image {timer_01_0}
}
}
1 {
set title [mc "Timer 0/1 in mode 1"]
- if {[subst "\${::SpecCalc::spec_chb_$obj_idx}"]} {
+ if {[subst -nocommands "\${::SpecCalc::spec_chb_$obj_idx}"]} {
set image {timer_01_1e}
- } {
+ } else {
set image {timer_01_1}
}
}
2 {
set title [mc "Timer 0/1 in mode 2"]
- if {[subst "\${::SpecCalc::spec_chb_$obj_idx}"]} {
+ if {[subst -nocommands "\${::SpecCalc::spec_chb_$obj_idx}"]} {
set image {timer_01_2e}
- } {
+ } else {
set image {timer_01_2}
}
}
@@ -2376,9 +2439,9 @@ class SpecCalc {
}
}
- set dlg [toplevel .spec_calc_diagram_$diagram_counter -class [mc "Diagram or formula"] -bg {#EEEEEE}]
+ set dlg [toplevel .spec_calc_diagram_$diagram_counter -class [mc "Diagram or formula"] -bg ${::COMMON_BG_COLOR}]
pack [label $dlg.image \
- -image [image create photo -format png -file "${::LIB_DIRNAME}/../icons/other/$image.png"]
+ -image [image create photo -format png -file "${::ROOT_DIRNAME}/icons/other/$image.png"]
] -fill both
wm title $dlg $title
@@ -2388,3 +2451,7 @@ class SpecCalc {
incr diagram_counter
}
}
+
+# >>> File inclusion guard
+}
+# <<< File inclusion guard