summaryrefslogtreecommitdiff
path: root/lib/utilities/notes.tcl
diff options
context:
space:
mode:
authorAndrej Shadura <andrewsh@debian.org>2018-05-08 15:59:31 +0200
committerAndrej Shadura <andrewsh@debian.org>2018-05-08 15:59:31 +0200
commit47aa8b00b2b11df13a100489e0f904a4947177ef (patch)
treeb35c9acc778ea2f761f3c549f7bee2f4491b3144 /lib/utilities/notes.tcl
parent5b8466f7fae0e071c0f4eda13051c93313910028 (diff)
Import Upstream version 1.4.7
Diffstat (limited to 'lib/utilities/notes.tcl')
-rw-r--r--[-rwxr-xr-x]lib/utilities/notes.tcl51
1 files changed, 31 insertions, 20 deletions
diff --git a/lib/utilities/notes.tcl b/lib/utilities/notes.tcl
index f39312f..d74b652 100755..100644
--- a/lib/utilities/notes.tcl
+++ b/lib/utilities/notes.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 _NOTES_TCL ] } {
+set _NOTES_TCL _
+# <<< File inclusion guard
+
# --------------------------------------------------------------------------
# DESCRIPTION:
# Scribble notes independent on project
@@ -32,10 +37,10 @@ class Notes {
common bgcolor {#EEEE55} ;# Color: Background color for title bar and window border
common bgcolor2 {#FFFF88} ;# Color: Background color for the canvas widget
# Font: For inserted text
- common canvas_text_font [font create \
- -family $::DEFAULT_FIXED_FONT \
- -size -14 \
- -weight bold \
+ common canvas_text_font [font create \
+ -family $::DEFAULT_FIXED_FONT \
+ -size [expr {int(-14 * $::font_size_factor)}] \
+ -weight bold \
]
# List: Popup menu for the canvas widget
common MENU {
@@ -118,7 +123,7 @@ class Notes {
set filename $_file_name
if {$_geometry == {}} {
set geometry {50 50 300 300}
- } {
+ } else {
set geometry $_geometry
}
@@ -133,7 +138,7 @@ class Notes {
-relief flat
ttk::style map Notes_Flat.TButton \
-relief [list active raised] \
- -background [list disabled {#EEEEEE}]
+ -background [list disabled ${::COMMON_BG_COLOR}]
create_win
}
@@ -270,7 +275,7 @@ class Notes {
if {[prompt_for_text]} {
$canvas_widget configure -cursor cross
set w $mode_text_but
- } {
+ } else {
if {$drawing_mode_org == {T}} {
set drawing_mode_org {M}
}
@@ -321,7 +326,7 @@ class Notes {
pack forget $main_frame
place $win -height [expr {[winfo height $win.title_bar] + 4}]
# Unshade
- } {
+ } else {
set image _1uparrow
pack $main_frame -fill both -expand 1 -padx 2 -pady 2
place $win -height [expr {[lindex $geometry 3] + 2}]
@@ -336,7 +341,7 @@ class Notes {
set popup_menu_created 1
set menu $canvas_widget.menu
- menuFactory $MENU $menu 0 "$this " 0 {}
+ menuFactory $MENU $menu 0 "$this " 0 {} [namespace current]
}
## Popup menu
@@ -484,7 +489,7 @@ class Notes {
-image ::ICONS::16::grid1 \
]
DynamicHelp::add $bottom_frame.mode_rectangle_but -text [mc "Retangle"]
- setStatusTip -widget $mode_rectangle_but -text [mc "Draw retangles"]
+ setStatusTip -widget $mode_rectangle_but -text [mc "Draw rectangles"]
pack $mode_rectangle_but -side left -ipady 0
# - Button "Oval"
set mode_oval_but [ttk::button $bottom_frame.mode_oval_but \
@@ -523,7 +528,7 @@ class Notes {
-command "$this select_color" \
-bd 1 -relief raised -overrelief raised \
-activebackground $selected_color \
- -bg $selected_color -pady 0 \
+ -bg $selected_color -pady 0 -width 2 \
]
DynamicHelp::add $bottom_frame.select_color_but -text [mc "Select color"]
setStatusTip -widget $select_color_but -text [mc "Select color"]
@@ -597,7 +602,7 @@ class Notes {
# @return void
private method prompt_for_text {} {
set ::Notes::text_prompt_text {}
- set dialog [toplevel .notes_pd -bg {#EEEEEE}]
+ set dialog [toplevel .notes_pd -bg ${::COMMON_BG_COLOR}]
## Create top frame
set frame [frame $dialog.frm]
@@ -865,10 +870,10 @@ class Notes {
KIFSD::FSD ::fsd \
-directory $directory \
-title [mc "Insert image from file"] \
- -defaultmask 0 -multiple 0 -filetypes {
- {{PNG files} {*.png}}
- {{All files} {*}}
- }
+ -defaultmask 0 -multiple 0 -filetypes [list \
+ [list [mc "Portable network graphics"] {*.png} ] \
+ [list [mc "All files"] {*} ] \
+ ]
::fsd setokcmd "$this load_image_file \[::fsd get\]"
::fsd activate
@@ -881,10 +886,12 @@ class Notes {
set loaded_image {}
if {[catch {
set loaded_image [image create photo -file $file]
- }]} {
- tk_messageBox \
+ }]} then {
+ tk_messageBox \
+ -parent . \
+ -type ok \
+ -icon warning \
-title [mc "Unable to read file"] \
- -type ok -icon warning \
-message [mc "Unable to read file:\n%s" $file]
return
}
@@ -894,3 +901,7 @@ class Notes {
}
}
}
+
+# >>> File inclusion guard
+}
+# <<< File inclusion guard