arcadia 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +126 -123
- data/arcadia.rb +770 -756
- data/base/a-contracts.rb +130 -93
- data/base/a-ext.rb +280 -280
- data/base/a-libs.rb +5 -11
- data/base/a-utils.rb +235 -44
- data/conf/arcadia.conf +20 -16
- data/conf/arcadia.init.rb +0 -0
- data/conf/arcadia.res.rb +74 -0
- data/ext/ae-complete-code/ae-complete-code.conf +0 -0
- data/ext/ae-complete-code/ae-complete-code.rb +80 -79
- data/ext/ae-debug/ae-debug.conf +0 -0
- data/ext/ae-debug/ae-debug.rb +2 -6
- data/ext/ae-debug/debug1.57.rb +0 -0
- data/ext/ae-doc-code/ae-doc-code.conf +15 -0
- data/ext/ae-doc-code/ae-doc-code.rb +289 -0
- data/ext/ae-editor/ae-editor.conf +17 -8
- data/ext/ae-editor/ae-editor.rb +738 -396
- data/ext/ae-event-log/ae-event-log.conf +0 -0
- data/ext/ae-event-log/ae-event-log.rb +0 -0
- data/ext/ae-file-history/ae-file-history.conf +2 -2
- data/ext/ae-file-history/ae-file-history.rb +286 -290
- data/ext/ae-inspector/ae-inspector.conf +0 -0
- data/ext/ae-inspector/ae-inspector.rb +0 -0
- data/ext/ae-output-event/ae-output-event.conf +2 -2
- data/ext/ae-output/ae-output.conf +2 -2
- data/ext/ae-output/ae-output.rb +173 -178
- data/ext/ae-palette/ae-palette.conf +0 -0
- data/ext/ae-palette/ae-palette.rb +0 -0
- data/ext/ae-shell/ae-shell.conf +0 -0
- data/ext/ae-shell/ae-shell.rb +54 -54
- data/lib/tk/al-tk.rb +3076 -3082
- data/lib/tk/al-tk.res.rb +0 -0
- data/lib/tk/al-tkarcadia.rb +0 -0
- data/lib/tk/al-tkcustom.rb +0 -0
- data/lib/tkext/al-bwidget.rb +0 -0
- data/lib/tkext/al-iwidgets.rb +0 -0
- data/lib/tkext/al-tile.rb +0 -0
- data/lib/tkext/al-tktable.rb +0 -0
- data/tcl/BWidget-1.8.0/BWman/ArrowButton.html +276 -0
- data/tcl/BWidget-1.8.0/BWman/BWidget.html +228 -0
- data/tcl/BWidget-1.8.0/BWman/Button.html +273 -0
- data/tcl/BWidget-1.8.0/BWman/ButtonBox.html +264 -0
- data/tcl/BWidget-1.8.0/BWman/ComboBox.html +402 -0
- data/tcl/BWidget-1.8.0/BWman/Dialog.html +314 -0
- data/tcl/BWidget-1.8.0/BWman/DragSite.html +139 -0
- data/tcl/BWidget-1.8.0/BWman/DropSite.html +254 -0
- data/tcl/BWidget-1.8.0/BWman/DynamicHelp.html +248 -0
- data/tcl/BWidget-1.8.0/BWman/Entry.html +341 -0
- data/tcl/BWidget-1.8.0/BWman/Label.html +331 -0
- data/tcl/BWidget-1.8.0/BWman/LabelEntry.html +194 -0
- data/tcl/BWidget-1.8.0/BWman/LabelFrame.html +144 -0
- data/tcl/BWidget-1.8.0/BWman/ListBox.html +678 -0
- data/tcl/BWidget-1.8.0/BWman/MainFrame.html +283 -0
- data/tcl/BWidget-1.8.0/BWman/MessageDlg.html +218 -0
- data/tcl/BWidget-1.8.0/BWman/NoteBook.html +374 -0
- data/tcl/BWidget-1.8.0/BWman/PagesManager.html +180 -0
- data/tcl/BWidget-1.8.0/BWman/PanedWindow.html +142 -0
- data/tcl/BWidget-1.8.0/BWman/PanelFrame.html +153 -0
- data/tcl/BWidget-1.8.0/BWman/PasswdDlg.html +214 -0
- data/tcl/BWidget-1.8.0/BWman/ProgressBar.html +152 -0
- data/tcl/BWidget-1.8.0/BWman/ProgressDlg.html +145 -0
- data/tcl/BWidget-1.8.0/BWman/ScrollView.html +130 -0
- data/tcl/BWidget-1.8.0/BWman/ScrollableFrame.html +191 -0
- data/tcl/BWidget-1.8.0/BWman/ScrolledWindow.html +116 -0
- data/tcl/BWidget-1.8.0/BWman/SelectColor.html +164 -0
- data/tcl/BWidget-1.8.0/BWman/SelectFont.html +152 -0
- data/tcl/BWidget-1.8.0/BWman/Separator.html +77 -0
- data/tcl/BWidget-1.8.0/BWman/SpinBox.html +250 -0
- data/tcl/BWidget-1.8.0/BWman/StatusBar.html +147 -0
- data/tcl/BWidget-1.8.0/BWman/TitleFrame.html +107 -0
- data/tcl/BWidget-1.8.0/BWman/Tree.html +947 -0
- data/tcl/BWidget-1.8.0/BWman/Widget.html +502 -0
- data/tcl/BWidget-1.8.0/BWman/contents.html +84 -0
- data/tcl/BWidget-1.8.0/BWman/index.html +7 -0
- data/tcl/BWidget-1.8.0/BWman/navtree.html +41 -0
- data/tcl/BWidget-1.8.0/BWman/options.htm +458 -0
- data/tcl/BWidget-1.8.0/CHANGES.txt +266 -0
- data/tcl/BWidget-1.8.0/ChangeLog +1641 -0
- data/tcl/BWidget-1.8.0/LICENSE.txt +41 -0
- data/tcl/BWidget-1.8.0/README.txt +127 -0
- data/tcl/BWidget-1.8.0/arrow.tcl +551 -0
- data/tcl/BWidget-1.8.0/bitmap.tcl +94 -0
- data/tcl/BWidget-1.8.0/button.tcl +324 -0
- data/tcl/BWidget-1.8.0/buttonbox.tcl +403 -0
- data/tcl/BWidget-1.8.0/color.tcl +493 -0
- data/tcl/BWidget-1.8.0/combobox.tcl +809 -0
- data/tcl/BWidget-1.8.0/demo/basic.tcl +199 -0
- data/tcl/BWidget-1.8.0/demo/bwidget.xbm +46 -0
- data/tcl/BWidget-1.8.0/demo/demo.tcl +212 -0
- data/tcl/BWidget-1.8.0/demo/dnd.tcl +42 -0
- data/tcl/BWidget-1.8.0/demo/manager.tcl +141 -0
- data/tcl/BWidget-1.8.0/demo/select.tcl +59 -0
- data/tcl/BWidget-1.8.0/demo/tmpldlg.tcl +214 -0
- data/tcl/BWidget-1.8.0/demo/tree.tcl +260 -0
- data/tcl/BWidget-1.8.0/demo/x1.xbm +2258 -0
- data/tcl/BWidget-1.8.0/dialog.tcl +345 -0
- data/tcl/BWidget-1.8.0/dragsite.tcl +197 -0
- data/tcl/BWidget-1.8.0/dropsite.tcl +455 -0
- data/tcl/BWidget-1.8.0/dynhelp.tcl +625 -0
- data/tcl/BWidget-1.8.0/entry.tcl +469 -0
- data/tcl/BWidget-1.8.0/font.tcl +566 -0
- data/tcl/BWidget-1.8.0/images/bold.gif +0 -0
- data/tcl/BWidget-1.8.0/images/copy.gif +0 -0
- data/tcl/BWidget-1.8.0/images/cut.gif +0 -0
- data/tcl/BWidget-1.8.0/images/dragfile.gif +0 -0
- data/tcl/BWidget-1.8.0/images/dragicon.gif +0 -0
- data/tcl/BWidget-1.8.0/images/error.gif +0 -0
- data/tcl/BWidget-1.8.0/images/file.gif +0 -0
- data/tcl/BWidget-1.8.0/images/folder.gif +0 -0
- data/tcl/BWidget-1.8.0/images/hourglass.gif +0 -0
- data/tcl/BWidget-1.8.0/images/info.gif +0 -0
- data/tcl/BWidget-1.8.0/images/italic.gif +0 -0
- data/tcl/BWidget-1.8.0/images/minus.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/new.gif +0 -0
- data/tcl/BWidget-1.8.0/images/opcopy.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/open.gif +0 -0
- data/tcl/BWidget-1.8.0/images/openfold.gif +0 -0
- data/tcl/BWidget-1.8.0/images/oplink.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/opmove.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/overstrike.gif +0 -0
- data/tcl/BWidget-1.8.0/images/palette.gif +0 -0
- data/tcl/BWidget-1.8.0/images/passwd.gif +0 -0
- data/tcl/BWidget-1.8.0/images/paste.gif +0 -0
- data/tcl/BWidget-1.8.0/images/plus.xbm +5 -0
- data/tcl/BWidget-1.8.0/images/print.gif +0 -0
- data/tcl/BWidget-1.8.0/images/question.gif +0 -0
- data/tcl/BWidget-1.8.0/images/redo.gif +0 -0
- data/tcl/BWidget-1.8.0/images/save.gif +0 -0
- data/tcl/BWidget-1.8.0/images/target.xbm +9 -0
- data/tcl/BWidget-1.8.0/images/underline.gif +0 -0
- data/tcl/BWidget-1.8.0/images/undo.gif +0 -0
- data/tcl/BWidget-1.8.0/images/warning.gif +0 -0
- data/tcl/BWidget-1.8.0/init.tcl +40 -0
- data/tcl/BWidget-1.8.0/label.tcl +271 -0
- data/tcl/BWidget-1.8.0/labelentry.tcl +100 -0
- data/tcl/BWidget-1.8.0/labelframe.tcl +160 -0
- data/tcl/BWidget-1.8.0/lang/da.rc +52 -0
- data/tcl/BWidget-1.8.0/lang/de.rc +52 -0
- data/tcl/BWidget-1.8.0/lang/en.rc +52 -0
- data/tcl/BWidget-1.8.0/lang/es.rc +53 -0
- data/tcl/BWidget-1.8.0/lang/fr.rc +52 -0
- data/tcl/BWidget-1.8.0/listbox.tcl +1638 -0
- data/tcl/BWidget-1.8.0/mainframe.tcl +711 -0
- data/tcl/BWidget-1.8.0/messagedlg.tcl +128 -0
- data/tcl/BWidget-1.8.0/notebook.tcl +1164 -0
- data/tcl/BWidget-1.8.0/pagesmgr.tcl +294 -0
- data/tcl/BWidget-1.8.0/panedw.tcl +381 -0
- data/tcl/BWidget-1.8.0/panelframe.tcl +246 -0
- data/tcl/BWidget-1.8.0/passwddlg.tcl +178 -0
- data/tcl/BWidget-1.8.0/pkgIndex.tcl +47 -0
- data/tcl/BWidget-1.8.0/progressbar.tcl +208 -0
- data/tcl/BWidget-1.8.0/progressdlg.tcl +87 -0
- data/tcl/BWidget-1.8.0/scrollframe.tcl +226 -0
- data/tcl/BWidget-1.8.0/scrollview.tcl +254 -0
- data/tcl/BWidget-1.8.0/scrollw.tcl +280 -0
- data/tcl/BWidget-1.8.0/separator.tcl +75 -0
- data/tcl/BWidget-1.8.0/spinbox.tcl +331 -0
- data/tcl/BWidget-1.8.0/statusbar.tcl +422 -0
- data/tcl/BWidget-1.8.0/tests/entry.test +173 -0
- data/tcl/BWidget-1.8.0/titleframe.tcl +170 -0
- data/tcl/BWidget-1.8.0/tree.tcl +2228 -0
- data/tcl/BWidget-1.8.0/utils.tcl +645 -0
- data/tcl/BWidget-1.8.0/widget.tcl +1576 -0
- data/tcl/BWidget-1.8.0/wizard.tcl +1028 -0
- data/tcl/BWidget-1.8.0/xpm2image.tcl +115 -0
- metadata +141 -5
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# ------------------------------------------------------------------------------
|
|
2
|
+
# messagedlg.tcl
|
|
3
|
+
# This file is part of Unifix BWidget Toolkit
|
|
4
|
+
# ------------------------------------------------------------------------------
|
|
5
|
+
# Index of commands:
|
|
6
|
+
# - MessageDlg::create
|
|
7
|
+
# ------------------------------------------------------------------------------
|
|
8
|
+
|
|
9
|
+
namespace eval MessageDlg {
|
|
10
|
+
Widget::define MessageDlg messagedlg Dialog
|
|
11
|
+
|
|
12
|
+
Widget::tkinclude MessageDlg message .frame.msg \
|
|
13
|
+
remove [list -cursor -highlightthickness \
|
|
14
|
+
-highlightbackground -highlightcolor \
|
|
15
|
+
-relief -borderwidth -takefocus -textvariable \
|
|
16
|
+
] \
|
|
17
|
+
rename [list -text -message] \
|
|
18
|
+
initialize [list -aspect 800 -anchor c -justify center]
|
|
19
|
+
|
|
20
|
+
Widget::bwinclude MessageDlg Dialog :cmd \
|
|
21
|
+
remove [list -modal -image -bitmap -side -anchor -separator \
|
|
22
|
+
-homogeneous -padx -pady -spacing]
|
|
23
|
+
|
|
24
|
+
Widget::declare MessageDlg {
|
|
25
|
+
{-icon Enum info 0 {none error info question warning}}
|
|
26
|
+
{-type Enum user 0 {abortretryignore ok okcancel \
|
|
27
|
+
retrycancel yesno yesnocancel user}}
|
|
28
|
+
{-buttons String "" 0}
|
|
29
|
+
{-buttonwidth String 0 0}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
Widget::addmap MessageDlg "" tkMBox {
|
|
33
|
+
-parent {} -message {} -default {} -title {}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# ------------------------------------------------------------------------------
|
|
39
|
+
# Command MessageDlg::create
|
|
40
|
+
# ------------------------------------------------------------------------------
|
|
41
|
+
proc MessageDlg::create { path args } {
|
|
42
|
+
global tcl_platform
|
|
43
|
+
|
|
44
|
+
array set maps [list MessageDlg {} :cmd {} .frame.msg {} tkMBox {}]
|
|
45
|
+
array set maps [Widget::parseArgs MessageDlg $args]
|
|
46
|
+
Widget::initFromODB MessageDlg "$path#Message" $maps(MessageDlg)
|
|
47
|
+
|
|
48
|
+
array set dialogArgs $maps(:cmd)
|
|
49
|
+
|
|
50
|
+
set type [Widget::cget "$path#Message" -type]
|
|
51
|
+
set icon [Widget::cget "$path#Message" -icon]
|
|
52
|
+
set width [Widget::cget "$path#Message" -buttonwidth]
|
|
53
|
+
|
|
54
|
+
set defb -1
|
|
55
|
+
set canb -1
|
|
56
|
+
switch -- $type {
|
|
57
|
+
abortretryignore {set lbut {abort retry ignore}; set defb 0}
|
|
58
|
+
ok {set lbut {ok}; set defb 0 }
|
|
59
|
+
okcancel {set lbut {ok cancel}; set defb 0; set canb 1}
|
|
60
|
+
retrycancel {set lbut {retry cancel}; set defb 0; set canb 1}
|
|
61
|
+
yesno {set lbut {yes no}; set defb 0; set canb 1}
|
|
62
|
+
yesnocancel {set lbut {yes no cancel}; set defb 0; set canb 2}
|
|
63
|
+
user {set lbut [Widget::cget "$path#Message" -buttons]}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
# If the user didn't specify a default button, use our type-specific
|
|
67
|
+
# default, adding its flag/value to the "user" settings and to the tkMBox
|
|
68
|
+
# settings
|
|
69
|
+
if { ![info exists dialogArgs(-default)] } {
|
|
70
|
+
lappend maps(:cmd) -default $defb
|
|
71
|
+
lappend maps(tkMBox) -default $defb
|
|
72
|
+
}
|
|
73
|
+
if { ![info exists dialogArgs(-cancel)] } {
|
|
74
|
+
lappend maps(:cmd) -cancel $canb
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
# Same with title as with default
|
|
78
|
+
if { ![info exists dialogArgs(-title)] } {
|
|
79
|
+
set frame [frame $path -class MessageDlg]
|
|
80
|
+
set title [option get $frame "${icon}Title" MessageDlg]
|
|
81
|
+
destroy $frame
|
|
82
|
+
if { $title == "" } {
|
|
83
|
+
set title "Message"
|
|
84
|
+
}
|
|
85
|
+
lappend maps(:cmd) -title $title
|
|
86
|
+
lappend maps(tkMBox) -title $title
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
# Create the "user" type dialog
|
|
90
|
+
if { $type == "user" } {
|
|
91
|
+
if { $icon != "none" } {
|
|
92
|
+
set image [Bitmap::get $icon]
|
|
93
|
+
} else {
|
|
94
|
+
set image ""
|
|
95
|
+
}
|
|
96
|
+
eval [list Dialog::create $path] $maps(:cmd) \
|
|
97
|
+
[list -image $image -modal local -side bottom -anchor e]
|
|
98
|
+
foreach but $lbut {
|
|
99
|
+
Dialog::add $path -text $but -name $but -width $width
|
|
100
|
+
}
|
|
101
|
+
set frame [Dialog::getframe $path]
|
|
102
|
+
|
|
103
|
+
eval [list message $frame.msg] $maps(.frame.msg) \
|
|
104
|
+
[list -relief flat -borderwidth 0 -highlightthickness 0 \
|
|
105
|
+
-textvariable ""]
|
|
106
|
+
pack $frame.msg -side left -padx 3m -pady 1m -fill x -expand yes
|
|
107
|
+
|
|
108
|
+
set res [Dialog::draw $path]
|
|
109
|
+
destroy $path
|
|
110
|
+
} else {
|
|
111
|
+
# Do some translation of args into tk_messageBox syntax, then create
|
|
112
|
+
# the tk_messageBox
|
|
113
|
+
array set tkMBoxArgs $maps(tkMBox)
|
|
114
|
+
set tkMBoxArgs(-default) [lindex $lbut $tkMBoxArgs(-default)]
|
|
115
|
+
if { ![string equal $icon "none"] } {
|
|
116
|
+
set tkMBoxArgs(-icon) $icon
|
|
117
|
+
}
|
|
118
|
+
if {[info exists tkMBoxArgs(-parent)]
|
|
119
|
+
&& ![winfo exists $tkMBoxArgs(-parent)]} {
|
|
120
|
+
unset tkMBoxArgs(-parent)
|
|
121
|
+
}
|
|
122
|
+
set tkMBoxArgs(-type) $type
|
|
123
|
+
set res [eval [list tk_messageBox] [array get tkMBoxArgs]]
|
|
124
|
+
set res [lsearch $lbut $res]
|
|
125
|
+
}
|
|
126
|
+
Widget::destroy "$path#Message"
|
|
127
|
+
return $res
|
|
128
|
+
}
|
|
@@ -0,0 +1,1164 @@
|
|
|
1
|
+
# ---------------------------------------------------------------------------
|
|
2
|
+
# notebook.tcl
|
|
3
|
+
# This file is part of Unifix BWidget Toolkit
|
|
4
|
+
# $Id: notebook.tcl,v 1.23 2005/01/26 01:01:26 hobbs Exp $
|
|
5
|
+
# ---------------------------------------------------------------------------
|
|
6
|
+
# Index of commands:
|
|
7
|
+
# - NoteBook::create
|
|
8
|
+
# - NoteBook::configure
|
|
9
|
+
# - NoteBook::cget
|
|
10
|
+
# - NoteBook::compute_size
|
|
11
|
+
# - NoteBook::insert
|
|
12
|
+
# - NoteBook::delete
|
|
13
|
+
# - NoteBook::itemconfigure
|
|
14
|
+
# - NoteBook::itemcget
|
|
15
|
+
# - NoteBook::bindtabs
|
|
16
|
+
# - NoteBook::raise
|
|
17
|
+
# - NoteBook::see
|
|
18
|
+
# - NoteBook::page
|
|
19
|
+
# - NoteBook::pages
|
|
20
|
+
# - NoteBook::index
|
|
21
|
+
# - NoteBook::getframe
|
|
22
|
+
# - NoteBook::_test_page
|
|
23
|
+
# - NoteBook::_itemconfigure
|
|
24
|
+
# - NoteBook::_compute_width
|
|
25
|
+
# - NoteBook::_get_x_page
|
|
26
|
+
# - NoteBook::_xview
|
|
27
|
+
# - NoteBook::_highlight
|
|
28
|
+
# - NoteBook::_select
|
|
29
|
+
# - NoteBook::_redraw
|
|
30
|
+
# - NoteBook::_draw_page
|
|
31
|
+
# - NoteBook::_draw_arrows
|
|
32
|
+
# - NoteBook::_draw_area
|
|
33
|
+
# - NoteBook::_resize
|
|
34
|
+
# ---------------------------------------------------------------------------
|
|
35
|
+
|
|
36
|
+
namespace eval NoteBook {
|
|
37
|
+
Widget::define NoteBook notebook ArrowButton DynamicHelp
|
|
38
|
+
|
|
39
|
+
namespace eval Page {
|
|
40
|
+
Widget::declare NoteBook::Page {
|
|
41
|
+
{-state Enum normal 0 {normal disabled}}
|
|
42
|
+
{-createcmd String "" 0}
|
|
43
|
+
{-raisecmd String "" 0}
|
|
44
|
+
{-leavecmd String "" 0}
|
|
45
|
+
{-image TkResource "" 0 label}
|
|
46
|
+
{-text String "" 0}
|
|
47
|
+
{-foreground String "" 0}
|
|
48
|
+
{-background String "" 0}
|
|
49
|
+
{-activeforeground String "" 0}
|
|
50
|
+
{-activebackground String "" 0}
|
|
51
|
+
{-disabledforeground String "" 0}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
DynamicHelp::include NoteBook::Page balloon
|
|
56
|
+
|
|
57
|
+
Widget::bwinclude NoteBook ArrowButton .c.fg \
|
|
58
|
+
include {-foreground -background -activeforeground \
|
|
59
|
+
-activebackground -disabledforeground -repeatinterval \
|
|
60
|
+
-repeatdelay -borderwidth} \
|
|
61
|
+
initialize {-borderwidth 1}
|
|
62
|
+
Widget::bwinclude NoteBook ArrowButton .c.fd \
|
|
63
|
+
include {-foreground -background -activeforeground \
|
|
64
|
+
-activebackground -disabledforeground -repeatinterval \
|
|
65
|
+
-repeatdelay -borderwidth} \
|
|
66
|
+
initialize {-borderwidth 1}
|
|
67
|
+
|
|
68
|
+
Widget::declare NoteBook {
|
|
69
|
+
{-foreground TkResource "" 0 button}
|
|
70
|
+
{-background TkResource "" 0 button}
|
|
71
|
+
{-activebackground TkResource "" 0 button}
|
|
72
|
+
{-activeforeground TkResource "" 0 button}
|
|
73
|
+
{-disabledforeground TkResource "" 0 button}
|
|
74
|
+
{-font TkResource "" 0 button}
|
|
75
|
+
{-side Enum top 0 {top bottom}}
|
|
76
|
+
{-homogeneous Boolean 0 0}
|
|
77
|
+
{-borderwidth Int 1 0 "%d >= 1 && %d <= 2"}
|
|
78
|
+
{-internalborderwidth Int 10 0 "%d >= 0"}
|
|
79
|
+
{-width Int 0 0 "%d >= 0"}
|
|
80
|
+
{-height Int 0 0 "%d >= 0"}
|
|
81
|
+
|
|
82
|
+
{-repeatdelay BwResource "" 0 ArrowButton}
|
|
83
|
+
{-repeatinterval BwResource "" 0 ArrowButton}
|
|
84
|
+
|
|
85
|
+
{-fg Synonym -foreground}
|
|
86
|
+
{-bg Synonym -background}
|
|
87
|
+
{-bd Synonym -borderwidth}
|
|
88
|
+
{-ibd Synonym -internalborderwidth}
|
|
89
|
+
|
|
90
|
+
{-arcradius Int 2 0 "%d >= 0 && %d <= 8"}
|
|
91
|
+
{-tabbevelsize Int 0 0 "%d >= 0 && %d <= 8"}
|
|
92
|
+
{-tabpady Padding {0 6} 0 "%d >= 0"}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
Widget::addmap NoteBook "" .c {-background {}}
|
|
96
|
+
|
|
97
|
+
variable _warrow 12
|
|
98
|
+
|
|
99
|
+
bind NoteBook <Configure> [list NoteBook::_resize %W]
|
|
100
|
+
bind NoteBook <Destroy> [list NoteBook::_destroy %W]
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
# ---------------------------------------------------------------------------
|
|
105
|
+
# Command NoteBook::create
|
|
106
|
+
# ---------------------------------------------------------------------------
|
|
107
|
+
proc NoteBook::create { path args } {
|
|
108
|
+
variable $path
|
|
109
|
+
upvar 0 $path data
|
|
110
|
+
|
|
111
|
+
Widget::init NoteBook $path $args
|
|
112
|
+
|
|
113
|
+
set data(base) 0
|
|
114
|
+
set data(select) ""
|
|
115
|
+
set data(pages) {}
|
|
116
|
+
set data(pages) {}
|
|
117
|
+
set data(cpt) 0
|
|
118
|
+
set data(realized) 0
|
|
119
|
+
set data(wpage) 0
|
|
120
|
+
|
|
121
|
+
_compute_height $path
|
|
122
|
+
|
|
123
|
+
# Create the canvas
|
|
124
|
+
set w [expr {[Widget::cget $path -width]+4}]
|
|
125
|
+
set h [expr {[Widget::cget $path -height]+$data(hpage)+4}]
|
|
126
|
+
|
|
127
|
+
frame $path -class NoteBook -borderwidth 0 -highlightthickness 0 \
|
|
128
|
+
-relief flat
|
|
129
|
+
eval [list canvas $path.c] [Widget::subcget $path .c] \
|
|
130
|
+
[list -relief flat -borderwidth 0 -highlightthickness 0 \
|
|
131
|
+
-width $w -height $h]
|
|
132
|
+
pack $path.c -expand yes -fill both
|
|
133
|
+
|
|
134
|
+
# Removing the Canvas global bindings from our canvas as
|
|
135
|
+
# application specific bindings on that tag may interfere with its
|
|
136
|
+
# operation here. [SF item #459033]
|
|
137
|
+
|
|
138
|
+
set bindings [bindtags $path.c]
|
|
139
|
+
set pos [lsearch -exact $bindings Canvas]
|
|
140
|
+
if {$pos >= 0} {
|
|
141
|
+
set bindings [lreplace $bindings $pos $pos]
|
|
142
|
+
}
|
|
143
|
+
bindtags $path.c $bindings
|
|
144
|
+
|
|
145
|
+
# Create the arrow button
|
|
146
|
+
eval [list ArrowButton::create $path.c.fg] [Widget::subcget $path .c.fg] \
|
|
147
|
+
[list -highlightthickness 0 -type button -dir left \
|
|
148
|
+
-armcommand [list NoteBook::_xview $path -1]]
|
|
149
|
+
|
|
150
|
+
eval [list ArrowButton::create $path.c.fd] [Widget::subcget $path .c.fd] \
|
|
151
|
+
[list -highlightthickness 0 -type button -dir right \
|
|
152
|
+
-armcommand [list NoteBook::_xview $path 1]]
|
|
153
|
+
|
|
154
|
+
Widget::create NoteBook $path
|
|
155
|
+
|
|
156
|
+
set bg [Widget::cget $path -background]
|
|
157
|
+
foreach {data(dbg) data(lbg)} [BWidget::get3dcolor $path $bg] {break}
|
|
158
|
+
|
|
159
|
+
return $path
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
# ---------------------------------------------------------------------------
|
|
164
|
+
# Command NoteBook::configure
|
|
165
|
+
# ---------------------------------------------------------------------------
|
|
166
|
+
proc NoteBook::configure { path args } {
|
|
167
|
+
variable $path
|
|
168
|
+
upvar 0 $path data
|
|
169
|
+
|
|
170
|
+
set res [Widget::configure $path $args]
|
|
171
|
+
set redraw 0
|
|
172
|
+
set opts [list -font -homogeneous -tabpady]
|
|
173
|
+
foreach {cf ch cp} [eval Widget::hasChangedX $path $opts] {break}
|
|
174
|
+
if {$cf || $ch || $cp} {
|
|
175
|
+
if { $cf || $cp } {
|
|
176
|
+
_compute_height $path
|
|
177
|
+
}
|
|
178
|
+
_compute_width $path
|
|
179
|
+
set redraw 1
|
|
180
|
+
}
|
|
181
|
+
set chibd [Widget::hasChanged $path -internalborderwidth ibd]
|
|
182
|
+
set chbg [Widget::hasChanged $path -background bg]
|
|
183
|
+
if {$chibd || $chbg} {
|
|
184
|
+
foreach page $data(pages) {
|
|
185
|
+
$path.f$page configure \
|
|
186
|
+
-borderwidth $ibd -background $bg
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if {$chbg} {
|
|
191
|
+
set col [BWidget::get3dcolor $path $bg]
|
|
192
|
+
set data(dbg) [lindex $col 0]
|
|
193
|
+
set data(lbg) [lindex $col 1]
|
|
194
|
+
set redraw 1
|
|
195
|
+
}
|
|
196
|
+
if { [Widget::hasChanged $path -foreground fg] ||
|
|
197
|
+
[Widget::hasChanged $path -borderwidth bd] ||
|
|
198
|
+
[Widget::hasChanged $path -arcradius radius] ||
|
|
199
|
+
[Widget::hasChanged $path -tabbevelsize bevel] ||
|
|
200
|
+
[Widget::hasChanged $path -side side] } {
|
|
201
|
+
set redraw 1
|
|
202
|
+
}
|
|
203
|
+
set wc [Widget::hasChanged $path -width w]
|
|
204
|
+
set hc [Widget::hasChanged $path -height h]
|
|
205
|
+
if { $wc || $hc } {
|
|
206
|
+
$path.c configure \
|
|
207
|
+
-width [expr {$w + 4}] \
|
|
208
|
+
-height [expr {$h + $data(hpage) + 4}]
|
|
209
|
+
}
|
|
210
|
+
if { $redraw } {
|
|
211
|
+
_redraw $path
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return $res
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
# ---------------------------------------------------------------------------
|
|
219
|
+
# Command NoteBook::cget
|
|
220
|
+
# ---------------------------------------------------------------------------
|
|
221
|
+
proc NoteBook::cget { path option } {
|
|
222
|
+
return [Widget::cget $path $option]
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
# ---------------------------------------------------------------------------
|
|
227
|
+
# Command NoteBook::compute_size
|
|
228
|
+
# ---------------------------------------------------------------------------
|
|
229
|
+
proc NoteBook::compute_size { path } {
|
|
230
|
+
variable $path
|
|
231
|
+
upvar 0 $path data
|
|
232
|
+
|
|
233
|
+
set wmax 0
|
|
234
|
+
set hmax 0
|
|
235
|
+
update idletasks
|
|
236
|
+
foreach page $data(pages) {
|
|
237
|
+
set w [winfo reqwidth $path.f$page]
|
|
238
|
+
set h [winfo reqheight $path.f$page]
|
|
239
|
+
set wmax [expr {$w>$wmax ? $w : $wmax}]
|
|
240
|
+
set hmax [expr {$h>$hmax ? $h : $hmax}]
|
|
241
|
+
}
|
|
242
|
+
configure $path -width $wmax -height $hmax
|
|
243
|
+
# Sven... well ok so this is called twice in some cases...
|
|
244
|
+
NoteBook::_redraw $path
|
|
245
|
+
# Sven end
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
# ---------------------------------------------------------------------------
|
|
250
|
+
# Command NoteBook::insert
|
|
251
|
+
# ---------------------------------------------------------------------------
|
|
252
|
+
proc NoteBook::insert { path index page args } {
|
|
253
|
+
variable $path
|
|
254
|
+
upvar 0 $path data
|
|
255
|
+
|
|
256
|
+
if { [lsearch -exact $data(pages) $page] != -1 } {
|
|
257
|
+
return -code error "page \"$page\" already exists"
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
set f $path.f$page
|
|
261
|
+
Widget::init NoteBook::Page $f $args
|
|
262
|
+
|
|
263
|
+
set data(pages) [linsert $data(pages) $index $page]
|
|
264
|
+
# If the page doesn't exist, create it; if it does reset its bg and ibd
|
|
265
|
+
if { ![winfo exists $f] } {
|
|
266
|
+
frame $f \
|
|
267
|
+
-relief flat \
|
|
268
|
+
-background [Widget::cget $path -background] \
|
|
269
|
+
-borderwidth [Widget::cget $path -internalborderwidth]
|
|
270
|
+
set data($page,realized) 0
|
|
271
|
+
} else {
|
|
272
|
+
$f configure \
|
|
273
|
+
-background [Widget::cget $path -background] \
|
|
274
|
+
-borderwidth [Widget::cget $path -internalborderwidth]
|
|
275
|
+
}
|
|
276
|
+
_compute_height $path
|
|
277
|
+
_compute_width $path
|
|
278
|
+
_draw_page $path $page 1
|
|
279
|
+
_set_help $path $page
|
|
280
|
+
_redraw $path
|
|
281
|
+
|
|
282
|
+
return $f
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
# ---------------------------------------------------------------------------
|
|
287
|
+
# Command NoteBook::delete
|
|
288
|
+
# ---------------------------------------------------------------------------
|
|
289
|
+
proc NoteBook::delete { path page {destroyframe 1} } {
|
|
290
|
+
variable $path
|
|
291
|
+
upvar 0 $path data
|
|
292
|
+
|
|
293
|
+
set pos [_test_page $path $page]
|
|
294
|
+
set data(pages) [lreplace $data(pages) $pos $pos]
|
|
295
|
+
_compute_width $path
|
|
296
|
+
$path.c delete p:$page
|
|
297
|
+
if { $data(select) == $page } {
|
|
298
|
+
set data(select) ""
|
|
299
|
+
}
|
|
300
|
+
if { $pos < $data(base) } {
|
|
301
|
+
incr data(base) -1
|
|
302
|
+
}
|
|
303
|
+
if { $destroyframe } {
|
|
304
|
+
destroy $path.f$page
|
|
305
|
+
}
|
|
306
|
+
_redraw $path
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
# ---------------------------------------------------------------------------
|
|
311
|
+
# Command NoteBook::itemconfigure
|
|
312
|
+
# ---------------------------------------------------------------------------
|
|
313
|
+
proc NoteBook::itemconfigure { path page args } {
|
|
314
|
+
_test_page $path $page
|
|
315
|
+
set res [_itemconfigure $path $page $args]
|
|
316
|
+
_redraw $path
|
|
317
|
+
|
|
318
|
+
return $res
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
# ---------------------------------------------------------------------------
|
|
323
|
+
# Command NoteBook::itemcget
|
|
324
|
+
# ---------------------------------------------------------------------------
|
|
325
|
+
proc NoteBook::itemcget { path page option } {
|
|
326
|
+
_test_page $path $page
|
|
327
|
+
return [Widget::cget $path.f$page $option]
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
# ---------------------------------------------------------------------------
|
|
332
|
+
# Command NoteBook::bindtabs
|
|
333
|
+
# ---------------------------------------------------------------------------
|
|
334
|
+
proc NoteBook::bindtabs { path event script } {
|
|
335
|
+
if { $script != "" } {
|
|
336
|
+
append script " \[NoteBook::_get_page_name [list $path] current 1\]"
|
|
337
|
+
$path.c bind "page" $event $script
|
|
338
|
+
} else {
|
|
339
|
+
$path.c bind "page" $event {}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
# ---------------------------------------------------------------------------
|
|
345
|
+
# Command NoteBook::move
|
|
346
|
+
# ---------------------------------------------------------------------------
|
|
347
|
+
proc NoteBook::move { path page index } {
|
|
348
|
+
variable $path
|
|
349
|
+
upvar 0 $path data
|
|
350
|
+
|
|
351
|
+
set pos [_test_page $path $page]
|
|
352
|
+
set data(pages) [linsert [lreplace $data(pages) $pos $pos] $index $page]
|
|
353
|
+
_redraw $path
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
# ---------------------------------------------------------------------------
|
|
358
|
+
# Command NoteBook::raise
|
|
359
|
+
# ---------------------------------------------------------------------------
|
|
360
|
+
proc NoteBook::raise { path {page ""} } {
|
|
361
|
+
variable $path
|
|
362
|
+
upvar 0 $path data
|
|
363
|
+
|
|
364
|
+
if { $page != "" } {
|
|
365
|
+
_test_page $path $page
|
|
366
|
+
_select $path $page
|
|
367
|
+
}
|
|
368
|
+
return $data(select)
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
# ---------------------------------------------------------------------------
|
|
373
|
+
# Command NoteBook::see
|
|
374
|
+
# ---------------------------------------------------------------------------
|
|
375
|
+
proc NoteBook::see { path page } {
|
|
376
|
+
variable $path
|
|
377
|
+
upvar 0 $path data
|
|
378
|
+
|
|
379
|
+
set pos [_test_page $path $page]
|
|
380
|
+
if { $pos < $data(base) } {
|
|
381
|
+
set data(base) $pos
|
|
382
|
+
_redraw $path
|
|
383
|
+
} else {
|
|
384
|
+
set w [expr {[winfo width $path]-1}]
|
|
385
|
+
set fpage [expr {[_get_x_page $path $pos] + $data($page,width) + 6}]
|
|
386
|
+
set idx $data(base)
|
|
387
|
+
while { $idx < $pos && $fpage > $w } {
|
|
388
|
+
set fpage [expr {$fpage - $data([lindex $data(pages) $idx],width)}]
|
|
389
|
+
incr idx
|
|
390
|
+
}
|
|
391
|
+
if { $idx != $data(base) } {
|
|
392
|
+
set data(base) $idx
|
|
393
|
+
_redraw $path
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
# ---------------------------------------------------------------------------
|
|
400
|
+
# Command NoteBook::page
|
|
401
|
+
# ---------------------------------------------------------------------------
|
|
402
|
+
proc NoteBook::page { path first {last ""} } {
|
|
403
|
+
variable $path
|
|
404
|
+
upvar 0 $path data
|
|
405
|
+
|
|
406
|
+
if { $last == "" } {
|
|
407
|
+
return [lindex $data(pages) $first]
|
|
408
|
+
} else {
|
|
409
|
+
return [lrange $data(pages) $first $last]
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
# ---------------------------------------------------------------------------
|
|
415
|
+
# Command NoteBook::pages
|
|
416
|
+
# ---------------------------------------------------------------------------
|
|
417
|
+
proc NoteBook::pages { path {first ""} {last ""}} {
|
|
418
|
+
variable $path
|
|
419
|
+
upvar 0 $path data
|
|
420
|
+
|
|
421
|
+
if { ![string length $first] } {
|
|
422
|
+
return $data(pages)
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
if { ![string length $last] } {
|
|
426
|
+
return [lindex $data(pages) $first]
|
|
427
|
+
} else {
|
|
428
|
+
return [lrange $data(pages) $first $last]
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
# ---------------------------------------------------------------------------
|
|
434
|
+
# Command NoteBook::index
|
|
435
|
+
# ---------------------------------------------------------------------------
|
|
436
|
+
proc NoteBook::index { path page } {
|
|
437
|
+
variable $path
|
|
438
|
+
upvar 0 $path data
|
|
439
|
+
|
|
440
|
+
return [lsearch -exact $data(pages) $page]
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
# ---------------------------------------------------------------------------
|
|
445
|
+
# Command NoteBook::_destroy
|
|
446
|
+
# ---------------------------------------------------------------------------
|
|
447
|
+
proc NoteBook::_destroy { path } {
|
|
448
|
+
variable $path
|
|
449
|
+
upvar 0 $path data
|
|
450
|
+
|
|
451
|
+
foreach page $data(pages) {
|
|
452
|
+
Widget::destroy $path.f$page
|
|
453
|
+
}
|
|
454
|
+
Widget::destroy $path
|
|
455
|
+
unset data
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
# ---------------------------------------------------------------------------
|
|
460
|
+
# Command NoteBook::getframe
|
|
461
|
+
# ---------------------------------------------------------------------------
|
|
462
|
+
proc NoteBook::getframe { path page } {
|
|
463
|
+
return $path.f$page
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
# ---------------------------------------------------------------------------
|
|
468
|
+
# Command NoteBook::_test_page
|
|
469
|
+
# ---------------------------------------------------------------------------
|
|
470
|
+
proc NoteBook::_test_page { path page } {
|
|
471
|
+
variable $path
|
|
472
|
+
upvar 0 $path data
|
|
473
|
+
|
|
474
|
+
if { [set pos [lsearch -exact $data(pages) $page]] == -1 } {
|
|
475
|
+
return -code error "page \"$page\" does not exists"
|
|
476
|
+
}
|
|
477
|
+
return $pos
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
proc NoteBook::_getoption { path page option } {
|
|
481
|
+
set value [Widget::cget $path.f$page $option]
|
|
482
|
+
if {![string length $value]} {
|
|
483
|
+
set value [Widget::cget $path $option]
|
|
484
|
+
}
|
|
485
|
+
return $value
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
# ---------------------------------------------------------------------------
|
|
489
|
+
# Command NoteBook::_itemconfigure
|
|
490
|
+
# ---------------------------------------------------------------------------
|
|
491
|
+
proc NoteBook::_itemconfigure { path page lres } {
|
|
492
|
+
variable $path
|
|
493
|
+
upvar 0 $path data
|
|
494
|
+
|
|
495
|
+
set res [Widget::configure $path.f$page $lres]
|
|
496
|
+
if { [Widget::hasChanged $path.f$page -text foo] } {
|
|
497
|
+
_compute_width $path
|
|
498
|
+
} elseif { [Widget::hasChanged $path.f$page -image foo] } {
|
|
499
|
+
_compute_height $path
|
|
500
|
+
_compute_width $path
|
|
501
|
+
}
|
|
502
|
+
if { [Widget::hasChanged $path.f$page -state state] &&
|
|
503
|
+
$state == "disabled" && $data(select) == $page } {
|
|
504
|
+
set data(select) ""
|
|
505
|
+
}
|
|
506
|
+
return $res
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
# ---------------------------------------------------------------------------
|
|
511
|
+
# Command NoteBook::_compute_width
|
|
512
|
+
# ---------------------------------------------------------------------------
|
|
513
|
+
proc NoteBook::_compute_width { path } {
|
|
514
|
+
variable $path
|
|
515
|
+
upvar 0 $path data
|
|
516
|
+
|
|
517
|
+
set wmax 0
|
|
518
|
+
set wtot 0
|
|
519
|
+
set hmax $data(hpage)
|
|
520
|
+
set font [Widget::cget $path -font]
|
|
521
|
+
if { ![info exists data(textid)] } {
|
|
522
|
+
set data(textid) [$path.c create text 0 -100 -font $font -anchor nw]
|
|
523
|
+
}
|
|
524
|
+
set id $data(textid)
|
|
525
|
+
$path.c itemconfigure $id -font $font
|
|
526
|
+
foreach page $data(pages) {
|
|
527
|
+
$path.c itemconfigure $id -text [Widget::cget $path.f$page -text]
|
|
528
|
+
# Get the bbox for this text to determine its width, then substract
|
|
529
|
+
# 6 from the width to account for canvas bbox oddness w.r.t. widths of
|
|
530
|
+
# simple text.
|
|
531
|
+
foreach {x1 y1 x2 y2} [$path.c bbox $id] break
|
|
532
|
+
set x2 [expr {$x2 - 6}]
|
|
533
|
+
set wtext [expr {$x2 - $x1 + 20}]
|
|
534
|
+
if { [set img [Widget::cget $path.f$page -image]] != "" } {
|
|
535
|
+
set wtext [expr {$wtext + [image width $img] + 4}]
|
|
536
|
+
set himg [expr {[image height $img] + 6}]
|
|
537
|
+
if { $himg > $hmax } {
|
|
538
|
+
set hmax $himg
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
set wmax [expr {$wtext > $wmax ? $wtext : $wmax}]
|
|
542
|
+
incr wtot $wtext
|
|
543
|
+
set data($page,width) $wtext
|
|
544
|
+
}
|
|
545
|
+
if { [Widget::cget $path -homogeneous] } {
|
|
546
|
+
foreach page $data(pages) {
|
|
547
|
+
set data($page,width) $wmax
|
|
548
|
+
}
|
|
549
|
+
set wtot [expr {$wmax * [llength $data(pages)]}]
|
|
550
|
+
}
|
|
551
|
+
set data(hpage) $hmax
|
|
552
|
+
set data(wpage) $wtot
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
# ---------------------------------------------------------------------------
|
|
557
|
+
# Command NoteBook::_compute_height
|
|
558
|
+
# ---------------------------------------------------------------------------
|
|
559
|
+
proc NoteBook::_compute_height { path } {
|
|
560
|
+
variable $path
|
|
561
|
+
upvar 0 $path data
|
|
562
|
+
|
|
563
|
+
set font [Widget::cget $path -font]
|
|
564
|
+
set pady0 [Widget::_get_padding $path -tabpady 0]
|
|
565
|
+
set pady1 [Widget::_get_padding $path -tabpady 1]
|
|
566
|
+
set metrics [font metrics $font -linespace]
|
|
567
|
+
set imgh 0
|
|
568
|
+
set lines 1
|
|
569
|
+
foreach page $data(pages) {
|
|
570
|
+
set img [Widget::cget $path.f$page -image]
|
|
571
|
+
set text [Widget::cget $path.f$page -text]
|
|
572
|
+
set len [llength [split $text \n]]
|
|
573
|
+
if {$len > $lines} { set lines $len}
|
|
574
|
+
if {$img != ""} {
|
|
575
|
+
set h [image height $img]
|
|
576
|
+
if {$h > $imgh} { set imgh $h }
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
set height [expr {$metrics * $lines}]
|
|
580
|
+
if {$imgh > $height} { set height $imgh }
|
|
581
|
+
set data(hpage) [expr {$height + $pady0 + $pady1}]
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
# ---------------------------------------------------------------------------
|
|
586
|
+
# Command NoteBook::_get_x_page
|
|
587
|
+
# ---------------------------------------------------------------------------
|
|
588
|
+
proc NoteBook::_get_x_page { path pos } {
|
|
589
|
+
variable _warrow
|
|
590
|
+
variable $path
|
|
591
|
+
upvar 0 $path data
|
|
592
|
+
|
|
593
|
+
set base $data(base)
|
|
594
|
+
# notebook tabs start flush with the left side of the notebook
|
|
595
|
+
set x 0
|
|
596
|
+
if { $pos < $base } {
|
|
597
|
+
foreach page [lrange $data(pages) $pos [expr {$base-1}]] {
|
|
598
|
+
incr x [expr {-$data($page,width)}]
|
|
599
|
+
}
|
|
600
|
+
} elseif { $pos > $base } {
|
|
601
|
+
foreach page [lrange $data(pages) $base [expr {$pos-1}]] {
|
|
602
|
+
incr x $data($page,width)
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
return $x
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
# ---------------------------------------------------------------------------
|
|
610
|
+
# Command NoteBook::_xview
|
|
611
|
+
# ---------------------------------------------------------------------------
|
|
612
|
+
proc NoteBook::_xview { path inc } {
|
|
613
|
+
variable $path
|
|
614
|
+
upvar 0 $path data
|
|
615
|
+
|
|
616
|
+
if { $inc == -1 } {
|
|
617
|
+
set base [expr {$data(base)-1}]
|
|
618
|
+
set dx $data([lindex $data(pages) $base],width)
|
|
619
|
+
} else {
|
|
620
|
+
set dx [expr {-$data([lindex $data(pages) $data(base)],width)}]
|
|
621
|
+
set base [expr {$data(base)+1}]
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
if { $base >= 0 && $base < [llength $data(pages)] } {
|
|
625
|
+
set data(base) $base
|
|
626
|
+
$path.c move page $dx 0
|
|
627
|
+
_draw_area $path
|
|
628
|
+
_draw_arrows $path
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
# ---------------------------------------------------------------------------
|
|
634
|
+
# Command NoteBook::_highlight
|
|
635
|
+
# ---------------------------------------------------------------------------
|
|
636
|
+
proc NoteBook::_highlight { type path page } {
|
|
637
|
+
variable $path
|
|
638
|
+
upvar 0 $path data
|
|
639
|
+
|
|
640
|
+
if { [string equal [Widget::cget $path.f$page -state] "disabled"] } {
|
|
641
|
+
return
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
switch -- $type {
|
|
645
|
+
on {
|
|
646
|
+
$path.c itemconfigure "$page:poly" \
|
|
647
|
+
-fill [_getoption $path $page -activebackground]
|
|
648
|
+
$path.c itemconfigure "$page:text" \
|
|
649
|
+
-fill [_getoption $path $page -activeforeground]
|
|
650
|
+
}
|
|
651
|
+
off {
|
|
652
|
+
$path.c itemconfigure "$page:poly" \
|
|
653
|
+
-fill [_getoption $path $page -background]
|
|
654
|
+
$path.c itemconfigure "$page:text" \
|
|
655
|
+
-fill [_getoption $path $page -foreground]
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
|
|
661
|
+
# ---------------------------------------------------------------------------
|
|
662
|
+
# Command NoteBook::_select
|
|
663
|
+
# ---------------------------------------------------------------------------
|
|
664
|
+
proc NoteBook::_select { path page } {
|
|
665
|
+
variable $path
|
|
666
|
+
upvar 0 $path data
|
|
667
|
+
|
|
668
|
+
if {![string equal [Widget::cget $path.f$page -state] "normal"]} { return }
|
|
669
|
+
|
|
670
|
+
set oldsel $data(select)
|
|
671
|
+
|
|
672
|
+
if {[string equal $page $oldsel]} { return }
|
|
673
|
+
|
|
674
|
+
if { ![string equal $oldsel ""] } {
|
|
675
|
+
set cmd [Widget::cget $path.f$oldsel -leavecmd]
|
|
676
|
+
if { ![string equal $cmd ""] } {
|
|
677
|
+
set code [catch {uplevel \#0 $cmd} res]
|
|
678
|
+
if { $code == 1 || $res == 0 } {
|
|
679
|
+
return -code $code $res
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
set data(select) ""
|
|
683
|
+
_draw_page $path $oldsel 0
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
set data(select) $page
|
|
687
|
+
if { ![string equal $page ""] } {
|
|
688
|
+
if { !$data($page,realized) } {
|
|
689
|
+
set data($page,realized) 1
|
|
690
|
+
set cmd [Widget::cget $path.f$page -createcmd]
|
|
691
|
+
if { ![string equal $cmd ""] } {
|
|
692
|
+
uplevel \#0 $cmd
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
set cmd [Widget::cget $path.f$page -raisecmd]
|
|
696
|
+
if { ![string equal $cmd ""] } {
|
|
697
|
+
uplevel \#0 $cmd
|
|
698
|
+
}
|
|
699
|
+
_draw_page $path $page 0
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
_draw_area $path
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
# -----------------------------------------------------------------------------
|
|
707
|
+
# Command NoteBook::_redraw
|
|
708
|
+
# -----------------------------------------------------------------------------
|
|
709
|
+
proc NoteBook::_redraw { path } {
|
|
710
|
+
variable $path
|
|
711
|
+
upvar 0 $path data
|
|
712
|
+
|
|
713
|
+
if { !$data(realized) } { return }
|
|
714
|
+
|
|
715
|
+
_compute_height $path
|
|
716
|
+
|
|
717
|
+
foreach page $data(pages) {
|
|
718
|
+
_draw_page $path $page 0
|
|
719
|
+
}
|
|
720
|
+
_draw_area $path
|
|
721
|
+
_draw_arrows $path
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
# ----------------------------------------------------------------------------
|
|
726
|
+
# Command NoteBook::_draw_page
|
|
727
|
+
# ----------------------------------------------------------------------------
|
|
728
|
+
proc NoteBook::_draw_page { path page create } {
|
|
729
|
+
variable $path
|
|
730
|
+
upvar 0 $path data
|
|
731
|
+
|
|
732
|
+
# --- calcul des coordonnees et des couleurs de l'onglet ------------------
|
|
733
|
+
set pos [lsearch -exact $data(pages) $page]
|
|
734
|
+
set bg [_getoption $path $page -background]
|
|
735
|
+
|
|
736
|
+
# lookup the tab colors
|
|
737
|
+
set fgt $data(lbg)
|
|
738
|
+
set fgb $data(dbg)
|
|
739
|
+
|
|
740
|
+
set h $data(hpage)
|
|
741
|
+
set xd [_get_x_page $path $pos]
|
|
742
|
+
set xf [expr {$xd + $data($page,width)}]
|
|
743
|
+
|
|
744
|
+
# Set the initial text offsets -- a few pixels down, centered left-to-right
|
|
745
|
+
set textOffsetY [expr [Widget::_get_padding $path -tabpady 0] + 3]
|
|
746
|
+
set textOffsetX 9
|
|
747
|
+
|
|
748
|
+
# Coordinates of the tab corners are:
|
|
749
|
+
# c3 c4
|
|
750
|
+
#
|
|
751
|
+
# c2 c5
|
|
752
|
+
#
|
|
753
|
+
# c1 c6
|
|
754
|
+
#
|
|
755
|
+
# where
|
|
756
|
+
# c1 = $xd, $h
|
|
757
|
+
# c2 = $xd+$xBevel, $arcRadius+2
|
|
758
|
+
# c3 = $xd+$xBevel+$arcRadius, $arcRadius
|
|
759
|
+
# c4 = $xf+1-$xBevel, $arcRadius
|
|
760
|
+
# c5 = $xf+$arcRadius-$xBevel, $arcRadius+2
|
|
761
|
+
# c6 = $xf+$arcRadius, $h
|
|
762
|
+
|
|
763
|
+
set top 2
|
|
764
|
+
set arcRadius [Widget::cget $path -arcradius]
|
|
765
|
+
set xBevel [Widget::cget $path -tabbevelsize]
|
|
766
|
+
|
|
767
|
+
if { $data(select) != $page } {
|
|
768
|
+
if { $pos == 0 } {
|
|
769
|
+
# The leftmost page is a special case -- it is drawn with its
|
|
770
|
+
# tab a little indented. To achieve this, we incr xd. We also
|
|
771
|
+
# decr textOffsetX, so that the text doesn't move left/right.
|
|
772
|
+
incr xd 2
|
|
773
|
+
incr textOffsetX -2
|
|
774
|
+
}
|
|
775
|
+
} else {
|
|
776
|
+
# The selected page's text is raised higher than the others
|
|
777
|
+
incr top -2
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
# Precompute some coord values that we use a lot
|
|
781
|
+
set topPlusRadius [expr {$top + $arcRadius}]
|
|
782
|
+
set rightPlusRadius [expr {$xf + $arcRadius}]
|
|
783
|
+
set leftPlusRadius [expr {$xd + $arcRadius}]
|
|
784
|
+
|
|
785
|
+
# Sven
|
|
786
|
+
set side [Widget::cget $path -side]
|
|
787
|
+
set tabsOnBottom [string equal $side "bottom"]
|
|
788
|
+
|
|
789
|
+
set h1 [expr {[winfo height $path]}]
|
|
790
|
+
set bd [Widget::cget $path -borderwidth]
|
|
791
|
+
if {$bd < 1} { set bd 1 }
|
|
792
|
+
|
|
793
|
+
if { $tabsOnBottom } {
|
|
794
|
+
# adjust to keep bottom edge in view
|
|
795
|
+
incr h1 -1
|
|
796
|
+
set top [expr {$top * -1}]
|
|
797
|
+
set topPlusRadius [expr {$topPlusRadius * -1}]
|
|
798
|
+
# Hrm... the canvas has an issue with drawing diagonal segments
|
|
799
|
+
# of lines from the bottom to the top, so we have to draw this line
|
|
800
|
+
# backwards (ie, lt is actually the bottom, drawn from right to left)
|
|
801
|
+
set lt [list \
|
|
802
|
+
$rightPlusRadius [expr {$h1-$h-1}] \
|
|
803
|
+
[expr {$rightPlusRadius - $xBevel}] [expr {$h1 + $topPlusRadius}] \
|
|
804
|
+
[expr {$xf - $xBevel}] [expr {$h1 + $top}] \
|
|
805
|
+
[expr {$leftPlusRadius + $xBevel}] [expr {$h1 + $top}] \
|
|
806
|
+
]
|
|
807
|
+
set lb [list \
|
|
808
|
+
[expr {$leftPlusRadius + $xBevel}] [expr {$h1 + $top}] \
|
|
809
|
+
[expr {$xd + $xBevel}] [expr {$h1 + $topPlusRadius}] \
|
|
810
|
+
$xd [expr {$h1-$h-1}] \
|
|
811
|
+
]
|
|
812
|
+
# Because we have to do this funky reverse order thing, we have to
|
|
813
|
+
# swap the top/bottom colors too.
|
|
814
|
+
set tmp $fgt
|
|
815
|
+
set fgt $fgb
|
|
816
|
+
set fgb $tmp
|
|
817
|
+
} else {
|
|
818
|
+
set lt [list \
|
|
819
|
+
$xd $h \
|
|
820
|
+
[expr {$xd + $xBevel}] $topPlusRadius \
|
|
821
|
+
[expr {$leftPlusRadius + $xBevel}] $top \
|
|
822
|
+
[expr {$xf + 1 - $xBevel}] $top \
|
|
823
|
+
]
|
|
824
|
+
set lb [list \
|
|
825
|
+
[expr {$xf + 1 - $xBevel}] [expr {$top + 1}] \
|
|
826
|
+
[expr {$rightPlusRadius - $xBevel}] $topPlusRadius \
|
|
827
|
+
$rightPlusRadius $h \
|
|
828
|
+
]
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
set img [Widget::cget $path.f$page -image]
|
|
832
|
+
|
|
833
|
+
set ytext $top
|
|
834
|
+
if { $tabsOnBottom } {
|
|
835
|
+
# The "+ 2" below moves the text closer to the bottom of the tab,
|
|
836
|
+
# so it doesn't look so cramped. I should be able to achieve the
|
|
837
|
+
# same goal by changing the anchor of the text and using this formula:
|
|
838
|
+
# ytext = $top + $h1 - $textOffsetY
|
|
839
|
+
# but that doesn't quite work (I think the linespace from the text
|
|
840
|
+
# gets in the way)
|
|
841
|
+
incr ytext [expr {$h1 - $h + 2}]
|
|
842
|
+
}
|
|
843
|
+
incr ytext $textOffsetY
|
|
844
|
+
|
|
845
|
+
set xtext [expr {$xd + $textOffsetX}]
|
|
846
|
+
if { $img != "" } {
|
|
847
|
+
# if there's an image, put it on the left and move the text right
|
|
848
|
+
set ximg $xtext
|
|
849
|
+
incr xtext [expr {[image width $img] + 2}]
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
if { $data(select) == $page } {
|
|
853
|
+
set bd [Widget::cget $path -borderwidth]
|
|
854
|
+
if {$bd < 1} { set bd 1 }
|
|
855
|
+
set fg [_getoption $path $page -foreground]
|
|
856
|
+
} else {
|
|
857
|
+
set bd 1
|
|
858
|
+
if { [Widget::cget $path.f$page -state] == "normal" } {
|
|
859
|
+
set fg [_getoption $path $page -foreground]
|
|
860
|
+
} else {
|
|
861
|
+
set fg [_getoption $path $page -disabledforeground]
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
# --- creation ou modification de l'onglet --------------------------------
|
|
866
|
+
# Sven
|
|
867
|
+
if { $create } {
|
|
868
|
+
# Create the tab region
|
|
869
|
+
eval [list $path.c create polygon] [concat $lt $lb] [list \
|
|
870
|
+
-tags [list page p:$page $page:poly] \
|
|
871
|
+
-outline $bg \
|
|
872
|
+
-fill $bg \
|
|
873
|
+
]
|
|
874
|
+
eval [list $path.c create line] $lt [list \
|
|
875
|
+
-tags [list page p:$page $page:top top] -fill $fgt -width $bd]
|
|
876
|
+
eval [list $path.c create line] $lb [list \
|
|
877
|
+
-tags [list page p:$page $page:bot bot] -fill $fgb -width $bd]
|
|
878
|
+
$path.c create text $xtext $ytext \
|
|
879
|
+
-text [Widget::cget $path.f$page -text] \
|
|
880
|
+
-font [Widget::cget $path -font] \
|
|
881
|
+
-fill $fg \
|
|
882
|
+
-anchor nw \
|
|
883
|
+
-tags [list page p:$page $page:text]
|
|
884
|
+
|
|
885
|
+
$path.c bind p:$page <ButtonPress-1> \
|
|
886
|
+
[list NoteBook::_select $path $page]
|
|
887
|
+
$path.c bind p:$page <Enter> \
|
|
888
|
+
[list NoteBook::_highlight on $path $page]
|
|
889
|
+
$path.c bind p:$page <Leave> \
|
|
890
|
+
[list NoteBook::_highlight off $path $page]
|
|
891
|
+
} else {
|
|
892
|
+
$path.c coords "$page:text" $xtext $ytext
|
|
893
|
+
|
|
894
|
+
$path.c itemconfigure "$page:text" \
|
|
895
|
+
-text [Widget::cget $path.f$page -text] \
|
|
896
|
+
-font [Widget::cget $path -font] \
|
|
897
|
+
-fill $fg
|
|
898
|
+
}
|
|
899
|
+
eval [list $path.c coords "$page:poly"] [concat $lt $lb]
|
|
900
|
+
eval [list $path.c coords "$page:top"] $lt
|
|
901
|
+
eval [list $path.c coords "$page:bot"] $lb
|
|
902
|
+
$path.c itemconfigure "$page:poly" -fill $bg -outline $bg
|
|
903
|
+
$path.c itemconfigure "$page:top" -fill $fgt -width $bd
|
|
904
|
+
$path.c itemconfigure "$page:bot" -fill $fgb -width $bd
|
|
905
|
+
|
|
906
|
+
# Sven end
|
|
907
|
+
|
|
908
|
+
if { $img != "" } {
|
|
909
|
+
# Sven
|
|
910
|
+
set id [$path.c find withtag $page:img]
|
|
911
|
+
if { [string equal $id ""] } {
|
|
912
|
+
set id [$path.c create image $ximg $ytext \
|
|
913
|
+
-anchor nw \
|
|
914
|
+
-tags [list page p:$page $page:img]]
|
|
915
|
+
}
|
|
916
|
+
$path.c coords $id $ximg $ytext
|
|
917
|
+
$path.c itemconfigure $id -image $img
|
|
918
|
+
# Sven end
|
|
919
|
+
} else {
|
|
920
|
+
$path.c delete $page:img
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
if { $data(select) == $page } {
|
|
924
|
+
$path.c raise p:$page
|
|
925
|
+
} elseif { $pos == 0 } {
|
|
926
|
+
if { $data(select) == "" } {
|
|
927
|
+
$path.c raise p:$page
|
|
928
|
+
} else {
|
|
929
|
+
$path.c lower p:$page p:$data(select)
|
|
930
|
+
}
|
|
931
|
+
} else {
|
|
932
|
+
set pred [lindex $data(pages) [expr {$pos-1}]]
|
|
933
|
+
if { $data(select) != $pred || $pos == 1 } {
|
|
934
|
+
$path.c lower p:$page p:$pred
|
|
935
|
+
} else {
|
|
936
|
+
$path.c lower p:$page p:[lindex $data(pages) [expr {$pos-2}]]
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
|
|
942
|
+
# -----------------------------------------------------------------------------
|
|
943
|
+
# Command NoteBook::_draw_arrows
|
|
944
|
+
# -----------------------------------------------------------------------------
|
|
945
|
+
proc NoteBook::_draw_arrows { path } {
|
|
946
|
+
variable _warrow
|
|
947
|
+
variable $path
|
|
948
|
+
upvar 0 $path data
|
|
949
|
+
|
|
950
|
+
set w [expr {[winfo width $path]-1}]
|
|
951
|
+
set h [expr {$data(hpage)-1}]
|
|
952
|
+
set nbpages [llength $data(pages)]
|
|
953
|
+
set xl 0
|
|
954
|
+
set xr [expr {$w-$_warrow+1}]
|
|
955
|
+
# Sven
|
|
956
|
+
set side [Widget::cget $path -side]
|
|
957
|
+
if { [string equal $side "bottom"] } {
|
|
958
|
+
set h1 [expr {[winfo height $path]-1}]
|
|
959
|
+
set bd [Widget::cget $path -borderwidth]
|
|
960
|
+
if {$bd < 1} { set bd 1 }
|
|
961
|
+
set y0 [expr {$h1 - $data(hpage) + $bd}]
|
|
962
|
+
} else {
|
|
963
|
+
set y0 1
|
|
964
|
+
}
|
|
965
|
+
# Sven end (all y positions where replaced with $y0 later)
|
|
966
|
+
|
|
967
|
+
if { $data(base) > 0 } {
|
|
968
|
+
# Sven
|
|
969
|
+
if { ![llength [$path.c find withtag "leftarrow"]] } {
|
|
970
|
+
$path.c create window $xl $y0 \
|
|
971
|
+
-width $_warrow \
|
|
972
|
+
-height $h \
|
|
973
|
+
-anchor nw \
|
|
974
|
+
-window $path.c.fg \
|
|
975
|
+
-tags "leftarrow"
|
|
976
|
+
} else {
|
|
977
|
+
$path.c coords "leftarrow" $xl $y0
|
|
978
|
+
$path.c itemconfigure "leftarrow" -width $_warrow -height $h
|
|
979
|
+
}
|
|
980
|
+
# Sven end
|
|
981
|
+
} else {
|
|
982
|
+
$path.c delete "leftarrow"
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
if { $data(base) < $nbpages-1 &&
|
|
986
|
+
$data(wpage) + [_get_x_page $path 0] + 6 > $w } {
|
|
987
|
+
# Sven
|
|
988
|
+
if { ![llength [$path.c find withtag "rightarrow"]] } {
|
|
989
|
+
$path.c create window $xr $y0 \
|
|
990
|
+
-width $_warrow \
|
|
991
|
+
-height $h \
|
|
992
|
+
-window $path.c.fd \
|
|
993
|
+
-anchor nw \
|
|
994
|
+
-tags "rightarrow"
|
|
995
|
+
} else {
|
|
996
|
+
$path.c coords "rightarrow" $xr $y0
|
|
997
|
+
$path.c itemconfigure "rightarrow" -width $_warrow -height $h
|
|
998
|
+
}
|
|
999
|
+
# Sven end
|
|
1000
|
+
} else {
|
|
1001
|
+
$path.c delete "rightarrow"
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
|
|
1006
|
+
# -----------------------------------------------------------------------------
|
|
1007
|
+
# Command NoteBook::_draw_area
|
|
1008
|
+
# -----------------------------------------------------------------------------
|
|
1009
|
+
proc NoteBook::_draw_area { path } {
|
|
1010
|
+
variable $path
|
|
1011
|
+
upvar 0 $path data
|
|
1012
|
+
|
|
1013
|
+
set w [expr {[winfo width $path] - 1}]
|
|
1014
|
+
set h [expr {[winfo height $path] - 1}]
|
|
1015
|
+
set bd [Widget::cget $path -borderwidth]
|
|
1016
|
+
if {$bd < 1} { set bd 1 }
|
|
1017
|
+
set x0 [expr {$bd - 1}]
|
|
1018
|
+
|
|
1019
|
+
set arcRadius [Widget::cget $path -arcradius]
|
|
1020
|
+
|
|
1021
|
+
# Sven
|
|
1022
|
+
set side [Widget::cget $path -side]
|
|
1023
|
+
if {"$side" == "bottom"} {
|
|
1024
|
+
set y0 0
|
|
1025
|
+
set y1 [expr {$h - $data(hpage)}]
|
|
1026
|
+
set yo $y1
|
|
1027
|
+
} else {
|
|
1028
|
+
set y0 $data(hpage)
|
|
1029
|
+
set y1 $h
|
|
1030
|
+
set yo [expr {$h-$y0}]
|
|
1031
|
+
}
|
|
1032
|
+
# Sven end
|
|
1033
|
+
set dbg $data(dbg)
|
|
1034
|
+
set sel $data(select)
|
|
1035
|
+
if { $sel == "" } {
|
|
1036
|
+
set xd [expr {$w/2}]
|
|
1037
|
+
set xf $xd
|
|
1038
|
+
set lbg $data(dbg)
|
|
1039
|
+
} else {
|
|
1040
|
+
set xd [_get_x_page $path [lsearch -exact $data(pages) $data(select)]]
|
|
1041
|
+
set xf [expr {$xd + $data($sel,width) + $arcRadius + 1}]
|
|
1042
|
+
set lbg $data(lbg)
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
# Sven
|
|
1046
|
+
if { [llength [$path.c find withtag rect]] == 0} {
|
|
1047
|
+
$path.c create line $xd $y0 $x0 $y0 $x0 $y1 \
|
|
1048
|
+
-tags "rect toprect1"
|
|
1049
|
+
$path.c create line $w $y0 $xf $y0 \
|
|
1050
|
+
-tags "rect toprect2"
|
|
1051
|
+
$path.c create line 1 $h $w $h $w $y0 \
|
|
1052
|
+
-tags "rect botrect"
|
|
1053
|
+
}
|
|
1054
|
+
if {"$side" == "bottom"} {
|
|
1055
|
+
$path.c coords "toprect1" $w $y0 $x0 $y0 $x0 $y1
|
|
1056
|
+
$path.c coords "toprect2" $x0 $y1 $xd $y1
|
|
1057
|
+
$path.c coords "botrect" $xf $y1 $w $y1 $w $y0
|
|
1058
|
+
$path.c itemconfigure "toprect1" -fill $lbg -width $bd
|
|
1059
|
+
$path.c itemconfigure "toprect2" -fill $dbg -width $bd
|
|
1060
|
+
$path.c itemconfigure "botrect" -fill $dbg -width $bd
|
|
1061
|
+
} else {
|
|
1062
|
+
$path.c coords "toprect1" $xd $y0 $x0 $y0 $x0 $y1
|
|
1063
|
+
$path.c coords "toprect2" $w $y0 $xf $y0
|
|
1064
|
+
$path.c coords "botrect" $x0 $h $w $h $w $y0
|
|
1065
|
+
$path.c itemconfigure "toprect1" -fill $lbg -width $bd
|
|
1066
|
+
$path.c itemconfigure "toprect2" -fill $lbg -width $bd
|
|
1067
|
+
$path.c itemconfigure "botrect" -fill $dbg -width $bd
|
|
1068
|
+
}
|
|
1069
|
+
$path.c raise "rect"
|
|
1070
|
+
# Sven end
|
|
1071
|
+
|
|
1072
|
+
if { $sel != "" } {
|
|
1073
|
+
# Sven
|
|
1074
|
+
if { [llength [$path.c find withtag "window"]] == 0 } {
|
|
1075
|
+
$path.c create window 2 [expr {$y0+1}] \
|
|
1076
|
+
-width [expr {$w-3}] \
|
|
1077
|
+
-height [expr {$yo-3}] \
|
|
1078
|
+
-anchor nw \
|
|
1079
|
+
-tags "window" \
|
|
1080
|
+
-window $path.f$sel
|
|
1081
|
+
}
|
|
1082
|
+
$path.c coords "window" 2 [expr {$y0+1}]
|
|
1083
|
+
$path.c itemconfigure "window" \
|
|
1084
|
+
-width [expr {$w-3}] \
|
|
1085
|
+
-height [expr {$yo-3}] \
|
|
1086
|
+
-window $path.f$sel
|
|
1087
|
+
# Sven end
|
|
1088
|
+
} else {
|
|
1089
|
+
$path.c delete "window"
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
|
|
1094
|
+
# -----------------------------------------------------------------------------
|
|
1095
|
+
# Command NoteBook::_resize
|
|
1096
|
+
# -----------------------------------------------------------------------------
|
|
1097
|
+
proc NoteBook::_resize { path } {
|
|
1098
|
+
variable $path
|
|
1099
|
+
upvar 0 $path data
|
|
1100
|
+
|
|
1101
|
+
if {!$data(realized)} {
|
|
1102
|
+
if { [set width [Widget::cget $path -width]] == 0 ||
|
|
1103
|
+
[set height [Widget::cget $path -height]] == 0 } {
|
|
1104
|
+
compute_size $path
|
|
1105
|
+
}
|
|
1106
|
+
set data(realized) 1
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
NoteBook::_redraw $path
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
|
|
1113
|
+
# Tree::_set_help --
|
|
1114
|
+
#
|
|
1115
|
+
# Register dynamic help for a node in the tree.
|
|
1116
|
+
#
|
|
1117
|
+
# Arguments:
|
|
1118
|
+
# path Tree to query
|
|
1119
|
+
# node Node in the tree
|
|
1120
|
+
# force Optional argument to force a reset of the help
|
|
1121
|
+
#
|
|
1122
|
+
# Results:
|
|
1123
|
+
# none
|
|
1124
|
+
# Tree::_set_help --
|
|
1125
|
+
#
|
|
1126
|
+
# Register dynamic help for a node in the tree.
|
|
1127
|
+
#
|
|
1128
|
+
# Arguments:
|
|
1129
|
+
# path Tree to query
|
|
1130
|
+
# node Node in the tree
|
|
1131
|
+
# force Optional argument to force a reset of the help
|
|
1132
|
+
#
|
|
1133
|
+
# Results:
|
|
1134
|
+
# none
|
|
1135
|
+
proc NoteBook::_set_help { path page } {
|
|
1136
|
+
Widget::getVariable $path help
|
|
1137
|
+
|
|
1138
|
+
set item $path.f$page
|
|
1139
|
+
set opts [list -helptype -helptext -helpvar]
|
|
1140
|
+
foreach {cty ctx cv} [eval [list Widget::hasChangedX $item] $opts] break
|
|
1141
|
+
set text [Widget::getoption $item -helptext]
|
|
1142
|
+
|
|
1143
|
+
## If we've never set help for this item before, and text is not blank,
|
|
1144
|
+
## we need to setup help. We also need to reset help if any of the
|
|
1145
|
+
## options have changed.
|
|
1146
|
+
if { (![info exists help($page)] && $text != "") || $cty || $ctx || $cv } {
|
|
1147
|
+
set help($page) 1
|
|
1148
|
+
set type [Widget::getoption $item -helptype]
|
|
1149
|
+
switch $type {
|
|
1150
|
+
balloon {
|
|
1151
|
+
DynamicHelp::register $path.c balloon p:$page $text
|
|
1152
|
+
}
|
|
1153
|
+
variable {
|
|
1154
|
+
set var [Widget::getoption $item -helpvar]
|
|
1155
|
+
DynamicHelp::register $path.c variable p:$page $var $text
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
|
|
1162
|
+
proc NoteBook::_get_page_name { path {item current} {tagindex end-1} } {
|
|
1163
|
+
return [string range [lindex [$path.c gettags $item] $tagindex] 2 end]
|
|
1164
|
+
}
|