summaryrefslogtreecommitdiff
path: root/lib/rightpanel/instructiondetails.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rightpanel/instructiondetails.tcl')
-rw-r--r--[-rwxr-xr-x]lib/rightpanel/instructiondetails.tcl98
1 files changed, 62 insertions, 36 deletions
diff --git a/lib/rightpanel/instructiondetails.tcl b/lib/rightpanel/instructiondetails.tcl
index 0c7efaf..88f0206 100755..100644
--- a/lib/rightpanel/instructiondetails.tcl
+++ b/lib/rightpanel/instructiondetails.tcl
@@ -2,7 +2,7 @@
# Part of MCU 8051 IDE ( http://mcu8051ide.sf.net )
############################################################################
-# Copyright (C) 2007-2009 by Martin Ošmera #
+# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 by Martin Ošmera #
# martin.osmera@gmail.com #
# #
# This program is free software; you can redistribute it and#or modify #
@@ -21,6 +21,11 @@
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
############################################################################
+# >>> File inclusion guard
+if { ! [ info exists _INSTRUCTIONDETAILS_TCL ] } {
+set _INSTRUCTIONDETAILS_TCL _
+# <<< File inclusion guard
+
# --------------------------------------------------------------------------
# DESCRIPTION
# Implements tab "Instruction details" on the Right Panel
@@ -30,9 +35,12 @@ class InstructionDetails {
## COMMON
# Conter of instances
- common count 0
+ common instd_count 0
# Font for instruction details
- common instruction_font [font create -size -12 -family $::DEFAULT_FIXED_FONT]
+ common instruction_font [font create \
+ -size [expr {int(-12 * $::font_size_factor)}] \
+ -family $::DEFAULT_FIXED_FONT \
+ ]
## Highlighting tags for instruction details
# {
# {tag_name foreground_color ?bold_or_italic?}
@@ -69,13 +77,13 @@ class InstructionDetails {
# }
common HELP_FOR_DIRECTIVES {}
common HELP_FOR_DIRECTIVES_RAW {
- elseif {Conditional assembly\n\nSyntax:\n ELSEIF <expr>\n\nExample:\n IF(2 * 4 - CND)\n MOV A, #20h\n ELSEIF SOMETHING_ELSE\n MOV A, #40h\n ENDIF\n\nNote:\n Supported by ASEM-51 only}
+ elseif {Conditional assembly\n\nSyntax:\n ELSEIF <expr>\n\nExample:\n IF(2 * 4 - CND)\n MOV A, #20h\n ELSEIF SOMETHING_ELSE\n MOV A, #40h\n ENDIF\n\n}
ifn {IF Not, conditional assembly\n\nSyntax:\n IFN <expr>\n\nExample:\n IF(2 * 4 - CND)\n MOV A, #20h\n ELSE\n MOV A, #40h\n ENDIF\n\n}
- elseifn {ELSE IF Not\n\nSyntax:\n ELSEIFN <expr>\n\nExample:\n IF(2 * 4 - CND)\n MOV A, #20h\n ELSEIFN SOMETHING_ELSE\n MOV A, #40h\n ENDIF\n\nNote:\n Supported by ASEM-51 only}
+ elseifn {ELSE IF Not\n\nSyntax:\n ELSEIFN <expr>\n\nExample:\n IF(2 * 4 - CND)\n MOV A, #20h\n ELSEIFN SOMETHING_ELSE\n MOV A, #40h\n ENDIF\n\n}
ifdef {IF DEFined\n\nSyntax:\n IFDEF <symbol>\n\nExample:\n IFDEF CND\n MOV A, #20h\n ELSE\n MOV A, #40h\n ENDIF\n\n}
- elseifdef {ELSE IF DEFined\n\nSyntax:\n ELSEIFDEF <symbol>\n\nExample:\n IFDEF(2 * 4 - CND)\n MOV A, #20h\n ELSEIFDEF SOMETHING_ELSE\n MOV A, #40h\n ENDIF\n\nNote:\n Supported by ASEM-51 only}
+ elseifdef {ELSE IF DEFined\n\nSyntax:\n ELSEIFDEF <symbol>\n\nExample:\n IFDEF(2 * 4 - CND)\n MOV A, #20h\n ELSEIFDEF SOMETHING_ELSE\n MOV A, #40h\n ENDIF\n\n}
ifndef {IF Not DEFined\n\nSyntax:\n IFNDEF <symbol>\n\nExample:\n IFNDEF CND\n MOV A, #20h\n ELSE\n MOV A, #40h\n ENDIF\n\n}
- elseifndef {ELSE IF Not DEFined\n\nSyntax:\n ELSEIFNDEF <symbol>\n\nExample:\n IFDEF CND\n MOV A, #20h\n ELSEIFNDEF SOMETHING_ELSE\n MOV A, #40h\n ENDIF\n\nNote:\n Supported by ASEM-51 only}
+ elseifndef {ELSE IF Not DEFined\n\nSyntax:\n ELSEIFNDEF <symbol>\n\nExample:\n IFDEF CND\n MOV A, #20h\n ELSEIFNDEF SOMETHING_ELSE\n MOV A, #40h\n ENDIF\n\n}
ifb {IF Black\n\nSyntax:\n IFB <literal>\n\nExample:\n IFB <CND>\n MOV A, #20h\n ELSE\n MOV A, #40h\n ENDIF\n\nNote:\n Supported by ASEM-51 only}
elseifb {ELSE IF Black\n\nSyntax:\n ELSEIFB <literal>\n\nExample:\n IFB <CND>\n MOV A, #20h\n ELSEIFB <SOMETHING_ELSE>\n MOV A, #40h\n ENDIF\n\literal:\n Supported by ASEM-51 only}
ifnb {IF Not Black\n\nSyntax:\n IFNB <literal>\n\nExample:\n IFNB <CND>\n MOV A, #20h\n ELSE\n MOV A, #40h\n ENDIF\n\nNote:\n Supported by ASEM-51 only}
@@ -96,11 +104,12 @@ class InstructionDetails {
bseg {switch to BIT segment \[at address\]\n\nSyntax:\n BSEG \[AT <expr>\]\n\nExample:\n BSEG at 5d\n\n}
xseg {switch to XDATA segment \[at address\]\n\nSyntax:\n XSEG \[AT <expr>\]\n\nExample:\n XSEG at 30d\n\n}
cseg {switch to CODE segment \[at address\]\n\nSyntax:\n CSEG \[AT <expr>\]\n\nExample:\n CSEG at 40d\n\n}
+ local {define a local label inside a macro\n\nSyntax:\n LOCAL <symbol>\n\nExample:\n ABC MACRO\n LOCAL xyz\n xyz: MOV B, #12d\n EXITM\n NOP\n ENDM\n\n}
flag {define a FLAG bit\n\nSyntax:\n <symbol> FLAG <expr>\n\nExample:\n F4 FLAG 16h\n\nNote:\n Deprecated directive. Consider directive BIT instead.}
skip {SKIP bytes in the code memory\n\nSyntax:\n SKIP <expr>\n\nExample:\n SKIP 5\n\n}
equ {EQUivalent\n\nSyntax:\n <symbol> EQU <expr>\n\nExample:\n ABC EQU R0\n XYZ EQU 4Eh+12\n\n}
bit {define BIT address\n\nSyntax:\n <symbol> BIT <expr>\n\nExample:\n ABC BIT P4.5\n\n}
- set {SET numeric variable or variable register\n\nSyntax:\n <symbol> SET <expr>\n <symbol> SET <register>\n\nExample:\n ALPHA SET R0\N ALPHA SET 42*BETA\n\n}
+ set {SET numeric variable or variable register\n\nSyntax:\n <symbol> SET <expr>\n <symbol> SET <register>\n\nExample:\n ALPHA SET R0\n ALPHA SET 42*BETA\n\n}
code {define address in the CODE memory\n\nSyntax:\n <symbol> CODE <expr>\n\nExample:\n TBL CODE 600h\n\n}
data {define address in the DATA memory\n\nSyntax:\n <symbol> DATA <expr>\n\nExample:\n UIV DATA 20h\n\n}
idata {define address in the Internal DATA memory\n\nSyntax:\n <symbol> IDATA <expr>\n\nExample:\n UIV IDATA 20h\n\n}
@@ -111,7 +120,7 @@ class InstructionDetails {
db {Define Bytes\n\nSyntax:\n DB <expr1> \[,<expr2> ... \]\n\nExample:\n DB 24,'August',09,(2*8+24)/8\n\n}
dbit {Define BITs\n\nSyntax:\n DBIT <expr>\n\nExample:\n DBIT 4+2\n\n}
include {INCLUDE an external source code\n\nSyntax:\n INCLUDE <filename>\n\nExample:\n INCLUDE 'my file.asm'\n\n}
- org {ORiGin of segment location\n\nSyntax:\n ORG <expr>\n\nExample:\n ORG 0Bh\n\n}
+ org {ORiGin of code segment location\n\nSyntax:\n ORG <expr>\n\nExample:\n ORG 0Bh\n\n}
using {USING register banks\n\nSyntax:\n USING <expr>\n\nExample:\n USING 2\n\n}
byte {define BYTE address in the data memory\n\nSyntax:\n <symbol> BYTE <expr>\n\nExample:\n UIV BYTE 20h\n\nNote:\n Deprecated directive. Consider directive DATA instead.}
@@ -875,7 +884,7 @@ class InstructionDetails {
private variable header_text ;# Widget: Text header
private variable instruction_last {} ;# String: Last instruction shown in details window
private variable parent {} ;# Widget: GUI parent
- private variable gui_initialized 0 ;# Bool: GUI initialized
+ private variable instd_gui_initialized 0 ;# Bool: GUI initialized
private variable gui_preparing 0 ;# Bool: Prearing panel GUI
private variable enabled 0 ;# Bool: enable procedures which are needless while loading project
@@ -886,11 +895,11 @@ class InstructionDetails {
private variable ins_help_window {} ;# Widget: Help window itself
private variable help_win_title ;# Widget: Title label (should contain instruction name and operands)
## Array of Widgets: Labels containing certain information
- # Avaliable keys are: description, length, execution_time, opcode, note and class
+ # available keys are: description, length, execution_time, opcode, note and class
private variable help_win_labels
constructor {} {
- incr count
+ incr instd_count
}
destructor {
@@ -901,13 +910,13 @@ class InstructionDetails {
# @return void
public method PrepareInstructionDetails {_parent} {
set parent $_parent
- set gui_initialized 0
+ set instd_gui_initialized 0
}
## Create GUI of tab "Instruction details"
# @return void
public method CreateInstructionDetailsGUI {} {
- if {$gui_initialized || $gui_preparing || ${::Editor::editor_to_use}} {return}
+ if {$instd_gui_initialized || $gui_preparing || ${::Editor::editor_to_use}} {return}
set gui_preparing 1
# Create frames
@@ -929,10 +938,14 @@ class InstructionDetails {
# Tab header (instruction name)
set instruction_label [label $header_frame.lbl_rightPanel_instruction_header \
- -fg {#0000FF} \
- -anchor w \
- -padx {20px} \
- -font [font create -weight {bold} -size -17 -family $::DEFAULT_FIXED_FONT] \
+ -fg {#0000FF} \
+ -anchor w \
+ -padx {20px} \
+ -font [font create \
+ -weight {bold} \
+ -size [expr {int(-17 * $::font_size_factor)}] \
+ -family $::DEFAULT_FIXED_FONT \
+ ] \
]
pack $instruction_label -side left -fill x -expand 1
setStatusTip -widget $instruction_label -text [mc "Instruction name"]
@@ -940,7 +953,7 @@ class InstructionDetails {
# Create popup menu for instruction text and its header
set instruction_menu [menu $text_frame.popup_menu -tearoff 0]
$instruction_menu add command -label "Configure" -compound left \
- -command {::configDialogs::rightPanel::mkDialog 1} \
+ -command {::configDialogues::rightPanel::mkDialog 1} \
-underline 0 -image ::ICONS::16::configure
# Text header
@@ -951,6 +964,7 @@ class InstructionDetails {
-height 1 \
-bd 0 \
-exportselection 0 \
+ -wrap none \
]
bind $header_text <ButtonRelease-3> "tk_popup $instruction_menu %X %Y; break"
bind $header_text <Key-Menu> "tk_popup $instruction_menu %X %Y; break"
@@ -959,7 +973,7 @@ class InstructionDetails {
# Instruction details text
set instruction_text [text $text_frame.txt_rightPanel_instruction \
-yscrollcommand "$body_frame.src_rightPanel_instruction set" \
- -cursor left_ptr -state disabled -wrap word \
+ -cursor left_ptr -state disabled -wrap none \
-font $instruction_font -bd 0 -exportselection 0 \
]
# Create scrollbar
@@ -979,7 +993,10 @@ class InstructionDetails {
$instruction_text tag configure tag_sel0 -background #E0FFE0
rightPanel_refresh_instruction_highlighting
$instruction_text tag configure tag_bold -font [font create \
- -size -12 -family $::DEFAULT_FIXED_FONT -weight {bold}]
+ -size [expr {int(-12 * $::font_size_factor)}] \
+ -family $::DEFAULT_FIXED_FONT \
+ -weight {bold} \
+ ]
# Pack parts of text frame (Instruction details text, Text header)
pack $header_text -side top -fill x
@@ -990,7 +1007,7 @@ class InstructionDetails {
pack $header_frame -side top -fill x
pack $body_frame -side bottom -fill both -expand 1
- set gui_initialized 1
+ set instd_gui_initialized 1
}
## Invoke legend window for "Instruction details"
@@ -1006,7 +1023,7 @@ class InstructionDetails {
set y [winfo pointery .]
# Create legend window
- set win [toplevel .rightPanel_legend -class {Help} -bg {#EEEEEE}]
+ set win [toplevel .rightPanel_legend -class {Help} -bg ${::COMMON_BG_COLOR}]
set frame [frame $win.f -bg {#555555} -bd 0 -padx 1 -pady 1]
wm overrideredirect $win 1
@@ -1152,7 +1169,8 @@ class InstructionDetails {
# @return void
public method rightPanel_ins_clear {} {
if {!$enabled || ${::Editor::editor_to_use}} {return}
- if {!$gui_initialized} {CreateInstructionDetailsGUI}
+ if {!$instd_gui_initialized} {CreateInstructionDetailsGUI}
+
$instruction_text configure -state normal
$instruction_text delete 1.0 end
$instruction_text configure -state disabled
@@ -1167,7 +1185,7 @@ class InstructionDetails {
# @return void
public method rightPanel_refresh_instruction_highlighting {} {
if {${::Editor::editor_to_use}} {return}
- if {!$gui_initialized && !$gui_preparing} {return}
+ if {!$instd_gui_initialized && !$gui_preparing} {return}
$this right_panel_create_highlighting_tags \
$instruction_text $instruction_tags 0
}
@@ -1176,12 +1194,12 @@ class InstructionDetails {
# @return void
public method rightPanel_ins_unselect {} {
if {!$enabled || ${::Editor::editor_to_use}} {return}
- if {!$gui_initialized} {return}
+ if {!$instd_gui_initialized} {return}
$instruction_text tag remove tag_sel 1.0 end
if {$::CONFIG(VALIDATION_LEVEL) == 2} {
$instruction_label configure -fg {#FF0000}
- } {
+ } else {
$instruction_label configure -fg {#0000FF}
}
}
@@ -1192,12 +1210,12 @@ class InstructionDetails {
# @return void
public method rightPanel_ins_select {perfect_match list_of_indexes} {
if {!$enabled || ${::Editor::editor_to_use}} {return}
- if {!$gui_initialized} {return}
+ if {!$instd_gui_initialized} {return}
if {[$instruction_label cget -text] == {}} {return}
$instruction_label configure -fg {#0000FF}
if {$perfect_match} {
set tag tag_sel
- } {
+ } else {
set tag tag_sel0
}
foreach line $list_of_indexes {
@@ -1213,7 +1231,7 @@ class InstructionDetails {
# @return void
public method rightPanel_dir_change {type directive} {
if {!$enabled || ${::Editor::editor_to_use}} {return}
- if {!$gui_initialized} {return}
+ if {!$instd_gui_initialized} {return}
regsub {^\.} $directive {} directive
set directive [string tolower $directive]
@@ -1225,7 +1243,7 @@ class InstructionDetails {
# Change content of tab header
if {$type == {D}} {
set clr {#00AADD}
- } {
+ } else {
set clr {#00AADD}
}
set dir_up [string toupper $directive]
@@ -1239,7 +1257,7 @@ class InstructionDetails {
set idx [lsearch -ascii -exact $HELP_FOR_DIRECTIVES $directive]
if {$idx == -1} {
$instruction_text insert end [mc "no help available for this directive"]
- } {
+ } else {
incr idx
$instruction_text insert end [lindex $HELP_FOR_DIRECTIVES $idx]
}
@@ -1259,7 +1277,7 @@ class InstructionDetails {
# @return void
public method rightPanel_ins_change {instruction} {
if {!$enabled || ${::Editor::editor_to_use}} {return}
- if {!$gui_initialized} {return}
+ if {!$instd_gui_initialized} {return}
set instruction [string tolower $instruction]
if {$instruction_last == $instruction} {return}
@@ -1333,7 +1351,7 @@ class InstructionDetails {
if {[string index $opr 0] == {@}} {
$instruction_text tag add tag_indr $startIndex insert-1c
# SFR
- } {
+ } else {
$instruction_text tag add tag_SFR $startIndex insert-1c
}
}
@@ -1580,15 +1598,19 @@ class InstructionDetails {
## Create instruciton help window
# @return void
private method create_ins_help_window {} {
+ if {$ins_help_win_created} {
+ return
+ }
set ins_help_win_created 1
# Create main parts of the window
- set ins_help_window [frame .ins_help_window${count} -bd 0 -bg {#BBBBFF} -padx 2 -pady 2]
+ incr instd_count
+ set ins_help_window [frame .ins_help_window${instd_count} -bd 0 -bg {#BBBBFF} -padx 2 -pady 2]
pack [frame $ins_help_window.top -bg {#BBBBFF}] -fill x -expand 1
pack [label $ins_help_window.top.img -bg {#BBBBFF} -image ::ICONS::16::info] -side left
pack [label $ins_help_window.top.tit -bg {#BBBBFF} -justify left -anchor w] -side left -fill x -expand 1
pack [frame $ins_help_window.msg -bg {#FFFFFF} -padx 10 -pady 5] -fill both -expand 1
- set help_win_title "$ins_help_window.top.tit"
+ set help_win_title "${ins_help_window}.top.tit"
## Create other parts of the window
# Descripton
@@ -1753,3 +1775,7 @@ class InstructionDetails {
# Initialize
::InstructionDetails::initialize
+
+# >>> File inclusion guard
+}
+# <<< File inclusion guard