Pratt 1.5.6
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/.exrc +61 -0
- data/.gitignore +4 -0
- data/History.txt +6 -0
- data/Manifest.txt +46 -0
- data/Pratt.gemspec +351 -0
- data/README.txt +66 -0
- data/Rakefile +85 -0
- data/TODO +54 -0
- data/VERSION +1 -0
- data/bin/pratt.rb +13 -0
- data/config.rb +34 -0
- data/lib/pratt.rb +527 -0
- data/lib/pratt/array.rb +11 -0
- data/lib/pratt/string.rb +18 -0
- data/models/app.rb +40 -0
- data/models/customer.rb +24 -0
- data/models/payment.rb +22 -0
- data/models/pratt.rb +19 -0
- data/models/project.rb +82 -0
- data/models/whence.rb +70 -0
- data/pkgs/tile-0.8.2.tar.gz +0 -0
- data/pkgs/tile-0.8.2/ANNOUNCE.txt +95 -0
- data/pkgs/tile-0.8.2/ChangeLog +4651 -0
- data/pkgs/tile-0.8.2/Makefile +250 -0
- data/pkgs/tile-0.8.2/Makefile.in +250 -0
- data/pkgs/tile-0.8.2/README.txt +86 -0
- data/pkgs/tile-0.8.2/aclocal.m4 +2 -0
- data/pkgs/tile-0.8.2/altTheme.o +0 -0
- data/pkgs/tile-0.8.2/blink.o +0 -0
- data/pkgs/tile-0.8.2/button.o +0 -0
- data/pkgs/tile-0.8.2/cache.o +0 -0
- data/pkgs/tile-0.8.2/clamTheme.o +0 -0
- data/pkgs/tile-0.8.2/classicTheme.o +0 -0
- data/pkgs/tile-0.8.2/config.log +1330 -0
- data/pkgs/tile-0.8.2/config.status +795 -0
- data/pkgs/tile-0.8.2/configure +15248 -0
- data/pkgs/tile-0.8.2/configure.in +89 -0
- data/pkgs/tile-0.8.2/demos/autocomplete.tcl +59 -0
- data/pkgs/tile-0.8.2/demos/demo.tcl +870 -0
- data/pkgs/tile-0.8.2/demos/dirbrowser.tcl +167 -0
- data/pkgs/tile-0.8.2/demos/dlgtest.tcl +97 -0
- data/pkgs/tile-0.8.2/demos/iconlib.tcl +110 -0
- data/pkgs/tile-0.8.2/demos/repeater.tcl +117 -0
- data/pkgs/tile-0.8.2/demos/toolbutton.tcl +101 -0
- data/pkgs/tile-0.8.2/doc/Geometry.3 +230 -0
- data/pkgs/tile-0.8.2/doc/INDEX.MAP +153 -0
- data/pkgs/tile-0.8.2/doc/Makefile +36 -0
- data/pkgs/tile-0.8.2/doc/TILE.XML +45 -0
- data/pkgs/tile-0.8.2/doc/Theme.3 +34 -0
- data/pkgs/tile-0.8.2/doc/button.n +75 -0
- data/pkgs/tile-0.8.2/doc/checkbutton.n +61 -0
- data/pkgs/tile-0.8.2/doc/combobox.n +98 -0
- data/pkgs/tile-0.8.2/doc/converting.txt +97 -0
- data/pkgs/tile-0.8.2/doc/dialog.n +122 -0
- data/pkgs/tile-0.8.2/doc/entry.n +438 -0
- data/pkgs/tile-0.8.2/doc/frame.n +43 -0
- data/pkgs/tile-0.8.2/doc/html/Geometry.html +304 -0
- data/pkgs/tile-0.8.2/doc/html/Theme.html +48 -0
- data/pkgs/tile-0.8.2/doc/html/button.html +120 -0
- data/pkgs/tile-0.8.2/doc/html/category-index.html +18 -0
- data/pkgs/tile-0.8.2/doc/html/checkbutton.html +94 -0
- data/pkgs/tile-0.8.2/doc/html/combobox.html +164 -0
- data/pkgs/tile-0.8.2/doc/html/converting.txt +97 -0
- data/pkgs/tile-0.8.2/doc/html/dialog.html +159 -0
- data/pkgs/tile-0.8.2/doc/html/entry.html +613 -0
- data/pkgs/tile-0.8.2/doc/html/frame.html +76 -0
- data/pkgs/tile-0.8.2/doc/html/image.html +100 -0
- data/pkgs/tile-0.8.2/doc/html/index.html +25 -0
- data/pkgs/tile-0.8.2/doc/html/keyword-index.html +228 -0
- data/pkgs/tile-0.8.2/doc/html/label.html +133 -0
- data/pkgs/tile-0.8.2/doc/html/labelframe.html +91 -0
- data/pkgs/tile-0.8.2/doc/html/manpage.css +212 -0
- data/pkgs/tile-0.8.2/doc/html/menubutton.html +63 -0
- data/pkgs/tile-0.8.2/doc/html/notebook.html +280 -0
- data/pkgs/tile-0.8.2/doc/html/paned.html +149 -0
- data/pkgs/tile-0.8.2/doc/html/progressbar.html +138 -0
- data/pkgs/tile-0.8.2/doc/html/radiobutton.html +89 -0
- data/pkgs/tile-0.8.2/doc/html/scrollbar.html +221 -0
- data/pkgs/tile-0.8.2/doc/html/separator.html +48 -0
- data/pkgs/tile-0.8.2/doc/html/sizegrip.html +62 -0
- data/pkgs/tile-0.8.2/doc/html/style.html +172 -0
- data/pkgs/tile-0.8.2/doc/html/tile-intro.html +164 -0
- data/pkgs/tile-0.8.2/doc/html/treeview.html +634 -0
- data/pkgs/tile-0.8.2/doc/html/widget.html +342 -0
- data/pkgs/tile-0.8.2/doc/image.n +81 -0
- data/pkgs/tile-0.8.2/doc/internals.txt +409 -0
- data/pkgs/tile-0.8.2/doc/label.n +75 -0
- data/pkgs/tile-0.8.2/doc/labelframe.n +64 -0
- data/pkgs/tile-0.8.2/doc/man.macros +239 -0
- data/pkgs/tile-0.8.2/doc/menubutton.n +41 -0
- data/pkgs/tile-0.8.2/doc/notebook.n +188 -0
- data/pkgs/tile-0.8.2/doc/paned.n +95 -0
- data/pkgs/tile-0.8.2/doc/progressbar.n +79 -0
- data/pkgs/tile-0.8.2/doc/radiobutton.n +57 -0
- data/pkgs/tile-0.8.2/doc/scrollbar.n +160 -0
- data/pkgs/tile-0.8.2/doc/separator.n +30 -0
- data/pkgs/tile-0.8.2/doc/sizegrip.n +53 -0
- data/pkgs/tile-0.8.2/doc/style.n +119 -0
- data/pkgs/tile-0.8.2/doc/tile-intro.n +165 -0
- data/pkgs/tile-0.8.2/doc/tmml.options +4 -0
- data/pkgs/tile-0.8.2/doc/treeview.n +415 -0
- data/pkgs/tile-0.8.2/doc/widget.n +227 -0
- data/pkgs/tile-0.8.2/doc/xml/Geometry.tmml +379 -0
- data/pkgs/tile-0.8.2/doc/xml/INDEX.MAP +153 -0
- data/pkgs/tile-0.8.2/doc/xml/Theme.tmml +63 -0
- data/pkgs/tile-0.8.2/doc/xml/button.tmml +134 -0
- data/pkgs/tile-0.8.2/doc/xml/checkbutton.tmml +119 -0
- data/pkgs/tile-0.8.2/doc/xml/combobox.tmml +184 -0
- data/pkgs/tile-0.8.2/doc/xml/dialog.tmml +195 -0
- data/pkgs/tile-0.8.2/doc/xml/entry.tmml +630 -0
- data/pkgs/tile-0.8.2/doc/xml/frame.tmml +98 -0
- data/pkgs/tile-0.8.2/doc/xml/image.tmml +101 -0
- data/pkgs/tile-0.8.2/doc/xml/label.tmml +154 -0
- data/pkgs/tile-0.8.2/doc/xml/labelframe.tmml +116 -0
- data/pkgs/tile-0.8.2/doc/xml/menubutton.tmml +80 -0
- data/pkgs/tile-0.8.2/doc/xml/notebook.tmml +306 -0
- data/pkgs/tile-0.8.2/doc/xml/paned.tmml +154 -0
- data/pkgs/tile-0.8.2/doc/xml/progressbar.tmml +151 -0
- data/pkgs/tile-0.8.2/doc/xml/radiobutton.tmml +109 -0
- data/pkgs/tile-0.8.2/doc/xml/scrollbar.tmml +233 -0
- data/pkgs/tile-0.8.2/doc/xml/separator.tmml +59 -0
- data/pkgs/tile-0.8.2/doc/xml/sizegrip.tmml +82 -0
- data/pkgs/tile-0.8.2/doc/xml/style.tmml +171 -0
- data/pkgs/tile-0.8.2/doc/xml/tile-intro.tmml +192 -0
- data/pkgs/tile-0.8.2/doc/xml/treeview.tmml +604 -0
- data/pkgs/tile-0.8.2/doc/xml/widget.tmml +372 -0
- data/pkgs/tile-0.8.2/entry.o +0 -0
- data/pkgs/tile-0.8.2/frame.o +0 -0
- data/pkgs/tile-0.8.2/generic/Makefile.in +221 -0
- data/pkgs/tile-0.8.2/generic/TODO +493 -0
- data/pkgs/tile-0.8.2/generic/altTheme.c +1172 -0
- data/pkgs/tile-0.8.2/generic/blink.c +168 -0
- data/pkgs/tile-0.8.2/generic/button.c +858 -0
- data/pkgs/tile-0.8.2/generic/cache.c +354 -0
- data/pkgs/tile-0.8.2/generic/clamTheme.c +974 -0
- data/pkgs/tile-0.8.2/generic/classicTheme.c +518 -0
- data/pkgs/tile-0.8.2/generic/configure +10334 -0
- data/pkgs/tile-0.8.2/generic/configure.in +100 -0
- data/pkgs/tile-0.8.2/generic/entry.c +1922 -0
- data/pkgs/tile-0.8.2/generic/frame.c +648 -0
- data/pkgs/tile-0.8.2/generic/gunk.h +44 -0
- data/pkgs/tile-0.8.2/generic/image.c +416 -0
- data/pkgs/tile-0.8.2/generic/label.c +663 -0
- data/pkgs/tile-0.8.2/generic/layout.c +1215 -0
- data/pkgs/tile-0.8.2/generic/manager.c +554 -0
- data/pkgs/tile-0.8.2/generic/manager.h +91 -0
- data/pkgs/tile-0.8.2/generic/notebook.c +1380 -0
- data/pkgs/tile-0.8.2/generic/paned.c +958 -0
- data/pkgs/tile-0.8.2/generic/pkgIndex.tcl.in +7 -0
- data/pkgs/tile-0.8.2/generic/progress.c +549 -0
- data/pkgs/tile-0.8.2/generic/scale.c +526 -0
- data/pkgs/tile-0.8.2/generic/scroll.c +253 -0
- data/pkgs/tile-0.8.2/generic/scrollbar.c +346 -0
- data/pkgs/tile-0.8.2/generic/separator.c +132 -0
- data/pkgs/tile-0.8.2/generic/square.c +306 -0
- data/pkgs/tile-0.8.2/generic/tagset.c +147 -0
- data/pkgs/tile-0.8.2/generic/tile.c +296 -0
- data/pkgs/tile-0.8.2/generic/tkElements.c +1280 -0
- data/pkgs/tile-0.8.2/generic/tkTheme.c +1708 -0
- data/pkgs/tile-0.8.2/generic/tkTheme.h +419 -0
- data/pkgs/tile-0.8.2/generic/tkThemeInt.h +45 -0
- data/pkgs/tile-0.8.2/generic/tkstate.c +268 -0
- data/pkgs/tile-0.8.2/generic/trace.c +145 -0
- data/pkgs/tile-0.8.2/generic/track.c +174 -0
- data/pkgs/tile-0.8.2/generic/treeview.c +3211 -0
- data/pkgs/tile-0.8.2/generic/ttk.decls +154 -0
- data/pkgs/tile-0.8.2/generic/ttkDecls.h +340 -0
- data/pkgs/tile-0.8.2/generic/ttkStubInit.c +61 -0
- data/pkgs/tile-0.8.2/generic/ttkStubLib.c +70 -0
- data/pkgs/tile-0.8.2/generic/widget.c +785 -0
- data/pkgs/tile-0.8.2/generic/widget.h +263 -0
- data/pkgs/tile-0.8.2/image.o +0 -0
- data/pkgs/tile-0.8.2/label.o +0 -0
- data/pkgs/tile-0.8.2/layout.o +0 -0
- data/pkgs/tile-0.8.2/library/altTheme.tcl +101 -0
- data/pkgs/tile-0.8.2/library/aquaTheme.tcl +62 -0
- data/pkgs/tile-0.8.2/library/button.tcl +85 -0
- data/pkgs/tile-0.8.2/library/clamTheme.tcl +139 -0
- data/pkgs/tile-0.8.2/library/classicTheme.tcl +108 -0
- data/pkgs/tile-0.8.2/library/combobox.tcl +439 -0
- data/pkgs/tile-0.8.2/library/cursors.tcl +36 -0
- data/pkgs/tile-0.8.2/library/defaults.tcl +118 -0
- data/pkgs/tile-0.8.2/library/dialog.tcl +274 -0
- data/pkgs/tile-0.8.2/library/entry.tcl +580 -0
- data/pkgs/tile-0.8.2/library/fonts.tcl +153 -0
- data/pkgs/tile-0.8.2/library/icons.tcl +105 -0
- data/pkgs/tile-0.8.2/library/keynav.tcl +192 -0
- data/pkgs/tile-0.8.2/library/menubutton.tcl +171 -0
- data/pkgs/tile-0.8.2/library/notebook.tcl +193 -0
- data/pkgs/tile-0.8.2/library/paned.tcl +87 -0
- data/pkgs/tile-0.8.2/library/progress.tcl +51 -0
- data/pkgs/tile-0.8.2/library/scale.tcl +54 -0
- data/pkgs/tile-0.8.2/library/scrollbar.tcl +125 -0
- data/pkgs/tile-0.8.2/library/sizegrip.tcl +77 -0
- data/pkgs/tile-0.8.2/library/tile.tcl +211 -0
- data/pkgs/tile-0.8.2/library/treeview.tcl +382 -0
- data/pkgs/tile-0.8.2/library/utils.tcl +254 -0
- data/pkgs/tile-0.8.2/library/winTheme.tcl +77 -0
- data/pkgs/tile-0.8.2/library/xpTheme.tcl +63 -0
- data/pkgs/tile-0.8.2/libtile0.8.2.so +0 -0
- data/pkgs/tile-0.8.2/libttkstub.a +0 -0
- data/pkgs/tile-0.8.2/license.terms +24 -0
- data/pkgs/tile-0.8.2/macosx/aquaTheme.c +1076 -0
- data/pkgs/tile-0.8.2/manager.o +0 -0
- data/pkgs/tile-0.8.2/notebook.o +0 -0
- data/pkgs/tile-0.8.2/paned.o +0 -0
- data/pkgs/tile-0.8.2/pkgIndex.tcl +3 -0
- data/pkgs/tile-0.8.2/progress.o +0 -0
- data/pkgs/tile-0.8.2/scale.o +0 -0
- data/pkgs/tile-0.8.2/scroll.o +0 -0
- data/pkgs/tile-0.8.2/scrollbar.o +0 -0
- data/pkgs/tile-0.8.2/separator.o +0 -0
- data/pkgs/tile-0.8.2/tagset.o +0 -0
- data/pkgs/tile-0.8.2/tclconfig/install-sh +119 -0
- data/pkgs/tile-0.8.2/tclconfig/tcl.m4 +4069 -0
- data/pkgs/tile-0.8.2/tclconfig/teax.m4 +109 -0
- data/pkgs/tile-0.8.2/tests/all.tcl +18 -0
- data/pkgs/tile-0.8.2/tests/bwidget.test +103 -0
- data/pkgs/tile-0.8.2/tests/cbtest.tcl +125 -0
- data/pkgs/tile-0.8.2/tests/combobox.test +51 -0
- data/pkgs/tile-0.8.2/tests/compound.tcl +92 -0
- data/pkgs/tile-0.8.2/tests/entry.test +285 -0
- data/pkgs/tile-0.8.2/tests/entrytest.tcl +78 -0
- data/pkgs/tile-0.8.2/tests/image.test +94 -0
- data/pkgs/tile-0.8.2/tests/labelframe.tcl +41 -0
- data/pkgs/tile-0.8.2/tests/labelframe.test +137 -0
- data/pkgs/tile-0.8.2/tests/layout.test +33 -0
- data/pkgs/tile-0.8.2/tests/misc.test +35 -0
- data/pkgs/tile-0.8.2/tests/nbtest.tcl +66 -0
- data/pkgs/tile-0.8.2/tests/notebook.test +500 -0
- data/pkgs/tile-0.8.2/tests/paned.test +298 -0
- data/pkgs/tile-0.8.2/tests/progress.test +92 -0
- data/pkgs/tile-0.8.2/tests/pwtest.tcl +90 -0
- data/pkgs/tile-0.8.2/tests/sbtest.tcl +79 -0
- data/pkgs/tile-0.8.2/tests/scrollbar.test +77 -0
- data/pkgs/tile-0.8.2/tests/sgtest.tcl +52 -0
- data/pkgs/tile-0.8.2/tests/testutils.tcl +20 -0
- data/pkgs/tile-0.8.2/tests/tile.test +674 -0
- data/pkgs/tile-0.8.2/tests/treetags.test +78 -0
- data/pkgs/tile-0.8.2/tests/treeview.test +563 -0
- data/pkgs/tile-0.8.2/tests/tvtest.tcl +332 -0
- data/pkgs/tile-0.8.2/tests/validate.test +278 -0
- data/pkgs/tile-0.8.2/tile.o +0 -0
- data/pkgs/tile-0.8.2/tkElements.o +0 -0
- data/pkgs/tile-0.8.2/tkTheme.o +0 -0
- data/pkgs/tile-0.8.2/tkstate.o +0 -0
- data/pkgs/tile-0.8.2/tools/genStubs.tcl +861 -0
- data/pkgs/tile-0.8.2/trace.o +0 -0
- data/pkgs/tile-0.8.2/track.o +0 -0
- data/pkgs/tile-0.8.2/treeview.o +0 -0
- data/pkgs/tile-0.8.2/ttkStubInit.o +0 -0
- data/pkgs/tile-0.8.2/ttkStubLib.o +0 -0
- data/pkgs/tile-0.8.2/widget.o +0 -0
- data/pkgs/tile-0.8.2/win/Tile.dsp +261 -0
- data/pkgs/tile-0.8.2/win/makefile.vc +527 -0
- data/pkgs/tile-0.8.2/win/monitor.c +164 -0
- data/pkgs/tile-0.8.2/win/nmakehlp.c +483 -0
- data/pkgs/tile-0.8.2/win/rules.vc +512 -0
- data/pkgs/tile-0.8.2/win/tile.rc +40 -0
- data/pkgs/tile-0.8.2/win/winTheme.c +734 -0
- data/pkgs/tile-0.8.2/win/xpTheme.c +1029 -0
- data/spec/app_spec.rb +48 -0
- data/spec/customer_spec.rb +31 -0
- data/spec/fixtures/graph.expectation +18 -0
- data/spec/payment_spec.rb +19 -0
- data/spec/pratt_spec.rb +148 -0
- data/spec/project_spec.rb +163 -0
- data/spec/rcov.opts +0 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/whence_spec.rb +54 -0
- data/tasks/pratt.rb +84 -0
- data/templates/model.eruby +12 -0
- data/templates/spec.eruby +8 -0
- data/views/env.rb +22 -0
- data/views/graph.eruby +20 -0
- data/views/invoice.eruby +148 -0
- data/views/main.rb +92 -0
- data/views/pid.eruby +3 -0
- data/views/pop.rb +94 -0
- data/views/pop2.rb +75 -0
- data/views/raw.eruby +11 -0
- metadata +390 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#
|
|
2
|
+
# cursors.tcl,v 1.3 2006/11/05 18:40:48 jenglish Exp
|
|
3
|
+
#
|
|
4
|
+
# Tile package: Symbolic cursor names.
|
|
5
|
+
#
|
|
6
|
+
# @@@ TODO: Figure out appropriate platform-specific cursors
|
|
7
|
+
# for the various functions.
|
|
8
|
+
#
|
|
9
|
+
|
|
10
|
+
namespace eval ttk {
|
|
11
|
+
|
|
12
|
+
variable Cursors
|
|
13
|
+
|
|
14
|
+
switch -glob $::tcl_platform(platform) {
|
|
15
|
+
|
|
16
|
+
"windows" {
|
|
17
|
+
array set Cursors {
|
|
18
|
+
hresize sb_h_double_arrow
|
|
19
|
+
vresize sb_v_double_arrow
|
|
20
|
+
seresize size_nw_se
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
"unix" -
|
|
25
|
+
* {
|
|
26
|
+
array set Cursors {
|
|
27
|
+
hresize sb_h_double_arrow
|
|
28
|
+
vresize sb_v_double_arrow
|
|
29
|
+
seresize bottom_right_corner
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
#*EOF*
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
#
|
|
2
|
+
# defaults.tcl,v 1.38 2007/11/18 18:09:26 jenglish Exp
|
|
3
|
+
#
|
|
4
|
+
# Settings for default theme.
|
|
5
|
+
#
|
|
6
|
+
|
|
7
|
+
namespace eval ttk::theme::default {
|
|
8
|
+
variable colors
|
|
9
|
+
array set colors {
|
|
10
|
+
-frame "#d9d9d9"
|
|
11
|
+
-window "#ffffff"
|
|
12
|
+
-activebg "#ececec"
|
|
13
|
+
-selectbg "#4a6984"
|
|
14
|
+
-selectfg "#ffffff"
|
|
15
|
+
-darker "#c3c3c3"
|
|
16
|
+
-disabledfg "#a3a3a3"
|
|
17
|
+
-indicator "#4a6984"
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
ttk::style theme settings default {
|
|
21
|
+
|
|
22
|
+
ttk::style configure "." \
|
|
23
|
+
-borderwidth 1 \
|
|
24
|
+
-background $colors(-frame) \
|
|
25
|
+
-foreground black \
|
|
26
|
+
-troughcolor $colors(-darker) \
|
|
27
|
+
-font TkDefaultFont \
|
|
28
|
+
-selectborderwidth 1 \
|
|
29
|
+
-selectbackground $colors(-selectbg) \
|
|
30
|
+
-selectforeground $colors(-selectfg) \
|
|
31
|
+
-insertwidth 1 \
|
|
32
|
+
-indicatordiameter 10 \
|
|
33
|
+
;
|
|
34
|
+
|
|
35
|
+
ttk::style map "." -background \
|
|
36
|
+
[list disabled $colors(-frame) active $colors(-activebg)]
|
|
37
|
+
ttk::style map "." -foreground \
|
|
38
|
+
[list disabled $colors(-disabledfg)]
|
|
39
|
+
|
|
40
|
+
ttk::style configure TButton \
|
|
41
|
+
-anchor center -padding "3 3" -width -9 \
|
|
42
|
+
-relief raised -shiftrelief 1
|
|
43
|
+
ttk::style map TButton -relief [list {!disabled pressed} sunken]
|
|
44
|
+
|
|
45
|
+
ttk::style configure TCheckbutton \
|
|
46
|
+
-indicatorcolor "#ffffff" -indicatorrelief sunken -padding 1
|
|
47
|
+
ttk::style map TCheckbutton -indicatorcolor \
|
|
48
|
+
[list pressed $colors(-activebg) selected $colors(-indicator)]
|
|
49
|
+
|
|
50
|
+
ttk::style configure TRadiobutton \
|
|
51
|
+
-indicatorcolor "#ffffff" -indicatorrelief sunken -padding 1
|
|
52
|
+
ttk::style map TRadiobutton -indicatorcolor \
|
|
53
|
+
[list pressed $colors(-activebg) selected $colors(-indicator)]
|
|
54
|
+
|
|
55
|
+
ttk::style configure TMenubutton \
|
|
56
|
+
-relief raised -padding "10 3"
|
|
57
|
+
|
|
58
|
+
ttk::style configure TEntry \
|
|
59
|
+
-relief sunken -fieldbackground white -padding 1
|
|
60
|
+
ttk::style map TEntry -fieldbackground \
|
|
61
|
+
[list readonly $colors(-frame) disabled $colors(-frame)]
|
|
62
|
+
|
|
63
|
+
ttk::style configure TCombobox -arrowsize 12 -padding 1
|
|
64
|
+
ttk::style map TCombobox -fieldbackground \
|
|
65
|
+
[list readonly $colors(-frame) disabled $colors(-frame)]
|
|
66
|
+
|
|
67
|
+
ttk::style configure TLabelframe \
|
|
68
|
+
-relief groove -borderwidth 2
|
|
69
|
+
|
|
70
|
+
ttk::style configure TScrollbar \
|
|
71
|
+
-width 12 -arrowsize 12
|
|
72
|
+
ttk::style map TScrollbar \
|
|
73
|
+
-arrowcolor [list disabled $colors(-disabledfg)]
|
|
74
|
+
|
|
75
|
+
ttk::style configure TScale \
|
|
76
|
+
-sliderrelief raised
|
|
77
|
+
ttk::style configure TProgressbar \
|
|
78
|
+
-background $colors(-selectbg)
|
|
79
|
+
|
|
80
|
+
ttk::style configure TNotebook.Tab \
|
|
81
|
+
-padding {4 2} -background $colors(-darker)
|
|
82
|
+
ttk::style map TNotebook.Tab \
|
|
83
|
+
-background [list selected $colors(-frame)]
|
|
84
|
+
|
|
85
|
+
# Treeview.
|
|
86
|
+
#
|
|
87
|
+
ttk::style configure Heading -font TkHeadingFont -relief raised
|
|
88
|
+
ttk::style configure Row -background $colors(-window)
|
|
89
|
+
ttk::style configure Cell -background $colors(-window)
|
|
90
|
+
ttk::style map Row \
|
|
91
|
+
-background [list selected $colors(-selectbg)] \
|
|
92
|
+
-foreground [list selected $colors(-selectfg)] ;
|
|
93
|
+
ttk::style map Cell \
|
|
94
|
+
-background [list selected $colors(-selectbg)] \
|
|
95
|
+
-foreground [list selected $colors(-selectfg)] ;
|
|
96
|
+
ttk::style map Item \
|
|
97
|
+
-background [list selected $colors(-selectbg)] \
|
|
98
|
+
-foreground [list selected $colors(-selectfg)] ;
|
|
99
|
+
|
|
100
|
+
#
|
|
101
|
+
# Toolbar buttons:
|
|
102
|
+
#
|
|
103
|
+
ttk::style layout Toolbutton {
|
|
104
|
+
Toolbutton.border -children {
|
|
105
|
+
Toolbutton.padding -children {
|
|
106
|
+
Toolbutton.label
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
ttk::style configure Toolbutton \
|
|
112
|
+
-padding 2 -relief flat
|
|
113
|
+
ttk::style map Toolbutton -relief \
|
|
114
|
+
[list disabled flat selected sunken pressed sunken active raised]
|
|
115
|
+
ttk::style map Toolbutton -background \
|
|
116
|
+
[list pressed $colors(-darker) active $colors(-activebg)]
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
#
|
|
2
|
+
# dialog.tcl,v 1.6 2007/07/10 21:53:26 jenglish Exp
|
|
3
|
+
#
|
|
4
|
+
# Copyright (c) 2005, Joe English. Freely redistributable.
|
|
5
|
+
#
|
|
6
|
+
# Tile widget set: dialog boxes.
|
|
7
|
+
#
|
|
8
|
+
# TODO: option to keep dialog onscreen ("persistent" / "transient")
|
|
9
|
+
# TODO: accelerator keys.
|
|
10
|
+
# TODO: use message catalogs for button labels
|
|
11
|
+
# TODO: routines to selectively enable/disable individual command buttons
|
|
12
|
+
# TODO: use megawidgetoid API [$dlg dismiss] vs. [ttk::dialog::dismiss $dlg]
|
|
13
|
+
# TODO: MAYBE: option for app-modal dialogs
|
|
14
|
+
# TODO: MAYBE: [wm withdraw] dialog on dismiss instead of self-destructing
|
|
15
|
+
#
|
|
16
|
+
|
|
17
|
+
package provide ttk::dialog 0.8
|
|
18
|
+
|
|
19
|
+
namespace eval ttk::dialog {
|
|
20
|
+
|
|
21
|
+
variable Config
|
|
22
|
+
#
|
|
23
|
+
# Spacing parameters:
|
|
24
|
+
# (taken from GNOME HIG 2.0, may need adjustment for other platforms)
|
|
25
|
+
# (textwidth just a guess)
|
|
26
|
+
#
|
|
27
|
+
set Config(margin) 12 ;# space between icon and text
|
|
28
|
+
set Config(interspace) 6 ;# horizontal space between buttons
|
|
29
|
+
set Config(sepspace) 24 ;# vertical space above buttons
|
|
30
|
+
set Config(textwidth) 400 ;# width of dialog box text (pixels)
|
|
31
|
+
|
|
32
|
+
variable DialogTypes ;# map -type => list of dialog options
|
|
33
|
+
variable ButtonOptions ;# map button name => list of button options
|
|
34
|
+
|
|
35
|
+
# stockButton -- define new built-in button
|
|
36
|
+
#
|
|
37
|
+
proc stockButton {button args} {
|
|
38
|
+
variable ButtonOptions
|
|
39
|
+
set ButtonOptions($button) $args
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
# Built-in button types:
|
|
43
|
+
#
|
|
44
|
+
stockButton ok -text OK
|
|
45
|
+
stockButton cancel -text Cancel
|
|
46
|
+
stockButton yes -text Yes
|
|
47
|
+
stockButton no -text No
|
|
48
|
+
stockButton retry -text Retry
|
|
49
|
+
|
|
50
|
+
# stockDialog -- define new dialog type.
|
|
51
|
+
#
|
|
52
|
+
proc stockDialog {type args} {
|
|
53
|
+
variable DialogTypes
|
|
54
|
+
set DialogTypes($type) $args
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
# Built-in dialog types:
|
|
58
|
+
#
|
|
59
|
+
stockDialog ok \
|
|
60
|
+
-icon info -buttons {ok} -default ok
|
|
61
|
+
stockDialog okcancel \
|
|
62
|
+
-icon info -buttons {ok cancel} -default ok -cancel cancel
|
|
63
|
+
stockDialog retrycancel \
|
|
64
|
+
-icon question -buttons {retry cancel} -cancel cancel
|
|
65
|
+
stockDialog yesno \
|
|
66
|
+
-icon question -buttons {yes no}
|
|
67
|
+
stockDialog yesnocancel \
|
|
68
|
+
-icon question -buttons {yes no cancel} -cancel cancel
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
## ttk::dialog::nop --
|
|
72
|
+
# Do nothing (used as a default callback command).
|
|
73
|
+
#
|
|
74
|
+
proc ttk::dialog::nop {args} { }
|
|
75
|
+
|
|
76
|
+
## ttk::dialog -- dialog box constructor.
|
|
77
|
+
#
|
|
78
|
+
interp alias {} ttk::dialog {} ttk::dialog::Constructor
|
|
79
|
+
|
|
80
|
+
proc ttk::dialog::Constructor {dlg args} {
|
|
81
|
+
upvar #0 $dlg D
|
|
82
|
+
variable Config
|
|
83
|
+
variable ButtonOptions
|
|
84
|
+
variable DialogTypes
|
|
85
|
+
|
|
86
|
+
#
|
|
87
|
+
# Option processing:
|
|
88
|
+
#
|
|
89
|
+
array set defaults {
|
|
90
|
+
-title ""
|
|
91
|
+
-message ""
|
|
92
|
+
-detail ""
|
|
93
|
+
-command ttk::dialog::nop
|
|
94
|
+
-icon ""
|
|
95
|
+
-buttons {}
|
|
96
|
+
-labels {}
|
|
97
|
+
-default {}
|
|
98
|
+
-cancel {}
|
|
99
|
+
-parent #AUTO
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
array set options [array get defaults]
|
|
103
|
+
|
|
104
|
+
foreach {option value} $args {
|
|
105
|
+
if {$option eq "-type"} {
|
|
106
|
+
array set options $DialogTypes($value)
|
|
107
|
+
} elseif {![info exists options($option)]} {
|
|
108
|
+
set validOptions [join [lsort [array names options]] ", "]
|
|
109
|
+
return -code error \
|
|
110
|
+
"Illegal option $option: must be one of $validOptions"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
array set options $args
|
|
114
|
+
|
|
115
|
+
# ...
|
|
116
|
+
#
|
|
117
|
+
array set buttonOptions [array get ::ttk::dialog::ButtonOptions]
|
|
118
|
+
foreach {button label} $options(-labels) {
|
|
119
|
+
lappend buttonOptions($button) -text $label
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
#
|
|
123
|
+
# Initialize dialog private data:
|
|
124
|
+
#
|
|
125
|
+
foreach option {-command -message -detail} {
|
|
126
|
+
set D($option) $options($option)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
toplevel $dlg -class Dialog; wm withdraw $dlg
|
|
130
|
+
|
|
131
|
+
#
|
|
132
|
+
# Determine default transient parent.
|
|
133
|
+
#
|
|
134
|
+
# NB: menus (including menubars) are considered toplevels,
|
|
135
|
+
# so skip over those.
|
|
136
|
+
#
|
|
137
|
+
if {$options(-parent) eq "#AUTO"} {
|
|
138
|
+
set parent [winfo toplevel [winfo parent $dlg]]
|
|
139
|
+
while {[winfo class $parent] eq "Menu" && $parent ne "."} {
|
|
140
|
+
set parent [winfo toplevel [winfo parent $parent]]
|
|
141
|
+
}
|
|
142
|
+
set options(-parent) $parent
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
#
|
|
146
|
+
# Build dialog:
|
|
147
|
+
#
|
|
148
|
+
if {$options(-parent) ne ""} {
|
|
149
|
+
wm transient $dlg $options(-parent)
|
|
150
|
+
}
|
|
151
|
+
wm title $dlg $options(-title)
|
|
152
|
+
wm protocol $dlg WM_DELETE_WINDOW { }
|
|
153
|
+
|
|
154
|
+
set f [ttk::frame $dlg.f]
|
|
155
|
+
|
|
156
|
+
ttk::label $f.icon
|
|
157
|
+
if {$options(-icon) ne ""} {
|
|
158
|
+
$f.icon configure -image [ttk::stockIcon dialog/$options(-icon)]
|
|
159
|
+
}
|
|
160
|
+
ttk::label $f.message -textvariable ${dlg}(-message) \
|
|
161
|
+
-font TkCaptionFont -wraplength $Config(textwidth)\
|
|
162
|
+
-anchor w -justify left
|
|
163
|
+
ttk::label $f.detail -textvariable ${dlg}(-detail) \
|
|
164
|
+
-font TkTextFont -wraplength $Config(textwidth) \
|
|
165
|
+
-anchor w -justify left
|
|
166
|
+
|
|
167
|
+
#
|
|
168
|
+
# Command buttons:
|
|
169
|
+
#
|
|
170
|
+
set cmd [ttk::frame $f.cmd]
|
|
171
|
+
set column 0
|
|
172
|
+
grid columnconfigure $f.cmd 0 -weight 1
|
|
173
|
+
|
|
174
|
+
foreach button $options(-buttons) {
|
|
175
|
+
incr column
|
|
176
|
+
eval [linsert $buttonOptions($button) 0 ttk::button $cmd.$button]
|
|
177
|
+
$cmd.$button configure -command [list ttk::dialog::Done $dlg $button]
|
|
178
|
+
grid $cmd.$button -row 0 -column $column \
|
|
179
|
+
-padx [list $Config(interspace) 0] -sticky ew
|
|
180
|
+
grid columnconfigure $cmd $column -uniform buttons
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if {$options(-default) ne ""} {
|
|
184
|
+
keynav::defaultButton $cmd.$options(-default)
|
|
185
|
+
focus $cmd.$options(-default)
|
|
186
|
+
}
|
|
187
|
+
if {$options(-cancel) ne ""} {
|
|
188
|
+
bind $dlg <KeyPress-Escape> \
|
|
189
|
+
[list event generate $cmd.$options(-cancel) <<Invoke>>]
|
|
190
|
+
wm protocol $dlg WM_DELETE_WINDOW \
|
|
191
|
+
[list event generate $cmd.$options(-cancel) <<Invoke>>]
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
#
|
|
195
|
+
# Assemble dialog.
|
|
196
|
+
#
|
|
197
|
+
pack $f.cmd -side bottom -expand false -fill x \
|
|
198
|
+
-pady [list $Config(sepspace) $Config(margin)] -padx $Config(margin)
|
|
199
|
+
|
|
200
|
+
if {0} {
|
|
201
|
+
# GNOME and Apple HIGs say not to use separators.
|
|
202
|
+
# But in case we want them anyway:
|
|
203
|
+
#
|
|
204
|
+
pack [ttk::separator $f.sep -orient horizontal] \
|
|
205
|
+
-side bottom -expand false -fill x \
|
|
206
|
+
-pady [list $Config(sepspace) 0] \
|
|
207
|
+
-padx $Config(margin)
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if {$options(-icon) ne ""} {
|
|
211
|
+
pack $f.icon -side left -anchor n -expand false \
|
|
212
|
+
-pady $Config(margin) -padx $Config(margin)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
pack $f.message -side top -expand false -fill x \
|
|
216
|
+
-padx $Config(margin) -pady $Config(margin)
|
|
217
|
+
if {$options(-detail) != ""} {
|
|
218
|
+
pack $f.detail -side top -expand false -fill x \
|
|
219
|
+
-padx $Config(margin)
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
# Client area goes here.
|
|
223
|
+
|
|
224
|
+
pack $f -expand true -fill both
|
|
225
|
+
keynav::enableMnemonics $dlg
|
|
226
|
+
wm deiconify $dlg
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
## ttk::dialog::clientframe --
|
|
230
|
+
# Returns the widget path of the dialog client frame,
|
|
231
|
+
# creating and managing it if necessary.
|
|
232
|
+
#
|
|
233
|
+
proc ttk::dialog::clientframe {dlg} {
|
|
234
|
+
variable Config
|
|
235
|
+
set client $dlg.f.client
|
|
236
|
+
if {![winfo exists $client]} {
|
|
237
|
+
pack [ttk::frame $client] -side top -expand true -fill both \
|
|
238
|
+
-pady $Config(margin) -padx $Config(margin)
|
|
239
|
+
lower $client ;# so it's first in keyboard traversal order
|
|
240
|
+
}
|
|
241
|
+
return $client
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
## ttk::dialog::Done --
|
|
245
|
+
# -command callback for dialog command buttons (internal)
|
|
246
|
+
#
|
|
247
|
+
proc ttk::dialog::Done {dlg button} {
|
|
248
|
+
upvar #0 $dlg D
|
|
249
|
+
set rc [catch [linsert $D(-command) end $button] result]
|
|
250
|
+
if {$rc == 1} {
|
|
251
|
+
return -code $rc -errorinfo $::errorInfo -errorcode $::errorCode $result
|
|
252
|
+
} elseif {$rc == 3 || $rc == 4} {
|
|
253
|
+
# break or continue -- don't dismiss dialog
|
|
254
|
+
return
|
|
255
|
+
}
|
|
256
|
+
dismiss $dlg
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
## ttk::dialog::activate $dlg $button --
|
|
260
|
+
# Simulate a button press.
|
|
261
|
+
#
|
|
262
|
+
proc ttk::dialog::activate {dlg button} {
|
|
263
|
+
event generate $dlg.f.cmd.$button <<Invoke>>
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
## dismiss --
|
|
267
|
+
# Dismiss the dialog (without invoking any actions).
|
|
268
|
+
#
|
|
269
|
+
proc ttk::dialog::dismiss {dlg} {
|
|
270
|
+
uplevel #0 [list unset $dlg]
|
|
271
|
+
destroy $dlg
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
#*EOF*
|
|
@@ -0,0 +1,580 @@
|
|
|
1
|
+
#
|
|
2
|
+
# entry.tcl,v 1.15 2007/09/30 16:56:11 jenglish Exp
|
|
3
|
+
#
|
|
4
|
+
# DERIVED FROM: tk/library/entry.tcl r1.22
|
|
5
|
+
#
|
|
6
|
+
# Copyright (c) 1992-1994 The Regents of the University of California.
|
|
7
|
+
# Copyright (c) 1994-1997 Sun Microsystems, Inc.
|
|
8
|
+
# Copyright (c) 2004, Joe English
|
|
9
|
+
#
|
|
10
|
+
# See the file "license.terms" for information on usage and redistribution
|
|
11
|
+
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
|
12
|
+
#
|
|
13
|
+
|
|
14
|
+
namespace eval ttk {
|
|
15
|
+
namespace eval entry {
|
|
16
|
+
variable State
|
|
17
|
+
|
|
18
|
+
set State(x) 0
|
|
19
|
+
set State(selectMode) char
|
|
20
|
+
set State(anchor) 0
|
|
21
|
+
set State(scanX) 0
|
|
22
|
+
set State(scanIndex) 0
|
|
23
|
+
set State(scanMoved) 0
|
|
24
|
+
|
|
25
|
+
# Button-2 scan speed is (scanNum/scanDen) characters
|
|
26
|
+
# per pixel of mouse movement.
|
|
27
|
+
# The standard Tk entry widget uses the equivalent of
|
|
28
|
+
# scanNum = 10, scanDen = average character width.
|
|
29
|
+
# I don't know why that was chosen.
|
|
30
|
+
#
|
|
31
|
+
set State(scanNum) 1
|
|
32
|
+
set State(scanDen) 1
|
|
33
|
+
set State(deadband) 3 ;# #pixels for mouse-moved deadband.
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
### Bindings.
|
|
38
|
+
#
|
|
39
|
+
# Removed the following standard Tk bindings:
|
|
40
|
+
#
|
|
41
|
+
# <Control-Key-space>, <Control-Shift-Key-space>,
|
|
42
|
+
# <Key-Select>, <Shift-Key-Select>:
|
|
43
|
+
# Tile entry widget doesn't use selection anchor.
|
|
44
|
+
# <Key-Insert>:
|
|
45
|
+
# Inserts PRIMARY selection (on non-Windows platforms).
|
|
46
|
+
# This is inconsistent with typical platform bindings.
|
|
47
|
+
# <Double-Shift-ButtonPress-1>, <Triple-Shift-ButtonPress-1>:
|
|
48
|
+
# These don't do the right thing to start with.
|
|
49
|
+
# <Meta-Key-b>, <Meta-Key-d>, <Meta-Key-f>,
|
|
50
|
+
# <Meta-Key-BackSpace>, <Meta-Key-Delete>:
|
|
51
|
+
# Judgment call. If <Meta> happens to be assigned to the Alt key,
|
|
52
|
+
# these could conflict with application accelerators.
|
|
53
|
+
# (Plus, who has a Meta key these days?)
|
|
54
|
+
# <Control-Key-t>:
|
|
55
|
+
# Another judgment call. If anyone misses this, let me know
|
|
56
|
+
# and I'll put it back.
|
|
57
|
+
#
|
|
58
|
+
|
|
59
|
+
## Clipboard events:
|
|
60
|
+
#
|
|
61
|
+
bind TEntry <<Cut>> { ttk::entry::Cut %W }
|
|
62
|
+
bind TEntry <<Copy>> { ttk::entry::Copy %W }
|
|
63
|
+
bind TEntry <<Paste>> { ttk::entry::Paste %W }
|
|
64
|
+
bind TEntry <<Clear>> { ttk::entry::Clear %W }
|
|
65
|
+
|
|
66
|
+
## Button1 bindings:
|
|
67
|
+
# Used for selection and navigation.
|
|
68
|
+
#
|
|
69
|
+
bind TEntry <ButtonPress-1> { ttk::entry::Press %W %x }
|
|
70
|
+
bind TEntry <Shift-ButtonPress-1> { ttk::entry::Shift-Press %W %x }
|
|
71
|
+
bind TEntry <Double-ButtonPress-1> { ttk::entry::Select %W %x word }
|
|
72
|
+
bind TEntry <Triple-ButtonPress-1> { ttk::entry::Select %W %x line }
|
|
73
|
+
bind TEntry <B1-Motion> { ttk::entry::Drag %W %x }
|
|
74
|
+
|
|
75
|
+
bind TEntry <B1-Leave> { ttk::Repeatedly ttk::entry::AutoScroll %W }
|
|
76
|
+
bind TEntry <B1-Enter> { ttk::CancelRepeat }
|
|
77
|
+
bind TEntry <ButtonRelease-1> { ttk::CancelRepeat }
|
|
78
|
+
|
|
79
|
+
bind TEntry <Control-ButtonPress-1> {
|
|
80
|
+
%W instate {!readonly !disabled} { %W icursor @%x ; focus %W }
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
## Button2 bindings:
|
|
84
|
+
# Used for scanning and primary transfer.
|
|
85
|
+
# Note: ButtonRelease-2 is mapped to <<PasteSelection>> in tk.tcl.
|
|
86
|
+
#
|
|
87
|
+
bind TEntry <ButtonPress-2> { ttk::entry::ScanMark %W %x }
|
|
88
|
+
bind TEntry <B2-Motion> { ttk::entry::ScanDrag %W %x }
|
|
89
|
+
bind TEntry <ButtonRelease-2> { ttk::entry::ScanRelease %W %x }
|
|
90
|
+
bind TEntry <<PasteSelection>> { ttk::entry::ScanRelease %W %x }
|
|
91
|
+
|
|
92
|
+
## Keyboard navigation bindings:
|
|
93
|
+
#
|
|
94
|
+
bind TEntry <Key-Left> { ttk::entry::Move %W prevchar }
|
|
95
|
+
bind TEntry <Key-Right> { ttk::entry::Move %W nextchar }
|
|
96
|
+
bind TEntry <Control-Key-Left> { ttk::entry::Move %W prevword }
|
|
97
|
+
bind TEntry <Control-Key-Right> { ttk::entry::Move %W nextword }
|
|
98
|
+
bind TEntry <Key-Home> { ttk::entry::Move %W home }
|
|
99
|
+
bind TEntry <Key-End> { ttk::entry::Move %W end }
|
|
100
|
+
|
|
101
|
+
bind TEntry <Shift-Key-Left> { ttk::entry::Extend %W prevchar }
|
|
102
|
+
bind TEntry <Shift-Key-Right> { ttk::entry::Extend %W nextchar }
|
|
103
|
+
bind TEntry <Shift-Control-Key-Left> { ttk::entry::Extend %W prevword }
|
|
104
|
+
bind TEntry <Shift-Control-Key-Right> { ttk::entry::Extend %W nextword }
|
|
105
|
+
bind TEntry <Shift-Key-Home> { ttk::entry::Extend %W home }
|
|
106
|
+
bind TEntry <Shift-Key-End> { ttk::entry::Extend %W end }
|
|
107
|
+
|
|
108
|
+
bind TEntry <Control-Key-slash> { %W selection range 0 end }
|
|
109
|
+
bind TEntry <Control-Key-backslash> { %W selection clear }
|
|
110
|
+
|
|
111
|
+
bind TEntry <<TraverseIn>> { %W selection range 0 end; %W icursor end }
|
|
112
|
+
|
|
113
|
+
## Edit bindings:
|
|
114
|
+
#
|
|
115
|
+
bind TEntry <KeyPress> { ttk::entry::Insert %W %A }
|
|
116
|
+
bind TEntry <Key-Delete> { ttk::entry::Delete %W }
|
|
117
|
+
bind TEntry <Key-BackSpace> { ttk::entry::Backspace %W }
|
|
118
|
+
|
|
119
|
+
# Ignore all Alt, Meta, and Control keypresses unless explicitly bound.
|
|
120
|
+
# Otherwise, the <KeyPress> class binding will fire and insert the character.
|
|
121
|
+
# Ditto for Escape, Return, and Tab.
|
|
122
|
+
#
|
|
123
|
+
bind TEntry <Alt-KeyPress> {# nothing}
|
|
124
|
+
bind TEntry <Meta-KeyPress> {# nothing}
|
|
125
|
+
bind TEntry <Control-KeyPress> {# nothing}
|
|
126
|
+
bind TEntry <Key-Escape> {# nothing}
|
|
127
|
+
bind TEntry <Key-Return> {# nothing}
|
|
128
|
+
bind TEntry <Key-KP_Enter> {# nothing}
|
|
129
|
+
bind TEntry <Key-Tab> {# nothing}
|
|
130
|
+
|
|
131
|
+
# Argh. Apparently on Windows, the NumLock modifier is interpreted
|
|
132
|
+
# as a Command modifier.
|
|
133
|
+
if {[tk windowingsystem] eq "aqua"} {
|
|
134
|
+
bind TEntry <Command-KeyPress> {# nothing}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
## Additional emacs-like bindings:
|
|
138
|
+
#
|
|
139
|
+
bind TEntry <Control-Key-a> { ttk::entry::Move %W home }
|
|
140
|
+
bind TEntry <Control-Key-b> { ttk::entry::Move %W prevchar }
|
|
141
|
+
bind TEntry <Control-Key-d> { ttk::entry::Delete %W }
|
|
142
|
+
bind TEntry <Control-Key-e> { ttk::entry::Move %W end }
|
|
143
|
+
bind TEntry <Control-Key-f> { ttk::entry::Move %W nextchar }
|
|
144
|
+
bind TEntry <Control-Key-h> { ttk::entry::Backspace %W }
|
|
145
|
+
bind TEntry <Control-Key-k> { %W delete insert end }
|
|
146
|
+
|
|
147
|
+
### Clipboard procedures.
|
|
148
|
+
#
|
|
149
|
+
|
|
150
|
+
## EntrySelection -- Return the selected text of the entry.
|
|
151
|
+
# Raises an error if there is no selection.
|
|
152
|
+
#
|
|
153
|
+
proc ttk::entry::EntrySelection {w} {
|
|
154
|
+
set entryString [string range [$w get] [$w index sel.first] \
|
|
155
|
+
[expr {[$w index sel.last] - 1}]]
|
|
156
|
+
if {[$w cget -show] ne ""} {
|
|
157
|
+
return [string repeat [string index [$w cget -show] 0] \
|
|
158
|
+
[string length $entryString]]
|
|
159
|
+
}
|
|
160
|
+
return $entryString
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
## Paste -- Insert clipboard contents at current insert point.
|
|
164
|
+
#
|
|
165
|
+
proc ttk::entry::Paste {w} {
|
|
166
|
+
catch {
|
|
167
|
+
set clipboard [::tk::GetSelection $w CLIPBOARD]
|
|
168
|
+
PendingDelete $w
|
|
169
|
+
$w insert insert $clipboard
|
|
170
|
+
See $w insert
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
## Copy -- Copy selection to clipboard.
|
|
175
|
+
#
|
|
176
|
+
proc ttk::entry::Copy {w} {
|
|
177
|
+
if {![catch {EntrySelection $w} selection]} {
|
|
178
|
+
clipboard clear -displayof $w
|
|
179
|
+
clipboard append -displayof $w $selection
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
## Clear -- Delete the selection.
|
|
184
|
+
#
|
|
185
|
+
proc ttk::entry::Clear {w} {
|
|
186
|
+
catch { $w delete sel.first sel.last }
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
## Cut -- Copy selection to clipboard then delete it.
|
|
190
|
+
#
|
|
191
|
+
proc ttk::entry::Cut {w} {
|
|
192
|
+
Copy $w; Clear $w
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
### Navigation procedures.
|
|
196
|
+
#
|
|
197
|
+
|
|
198
|
+
## ClosestGap -- Find closest boundary between characters.
|
|
199
|
+
# Returns the index of the character just after the boundary.
|
|
200
|
+
#
|
|
201
|
+
proc ttk::entry::ClosestGap {w x} {
|
|
202
|
+
set pos [$w index @$x]
|
|
203
|
+
set bbox [$w bbox $pos]
|
|
204
|
+
if {$x - [lindex $bbox 0] > [lindex $bbox 2]/2} {
|
|
205
|
+
incr pos
|
|
206
|
+
}
|
|
207
|
+
return $pos
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
## See $index -- Make sure that the character at $index is visible.
|
|
211
|
+
#
|
|
212
|
+
proc ttk::entry::See {w {index insert}} {
|
|
213
|
+
update idletasks ;# ensure scroll data up-to-date
|
|
214
|
+
set c [$w index $index]
|
|
215
|
+
# @@@ OR: check [$w index left] / [$w index right]
|
|
216
|
+
if {$c < [$w index @0] || $c >= [$w index @[winfo width $w]]} {
|
|
217
|
+
$w xview $c
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
## NextWord -- Find the next word position.
|
|
222
|
+
# Note: The "next word position" follows platform conventions:
|
|
223
|
+
# either the next end-of-word position, or the start-of-word
|
|
224
|
+
# position following the next end-of-word position.
|
|
225
|
+
#
|
|
226
|
+
set ::ttk::entry::State(startNext) \
|
|
227
|
+
[string equal $tcl_platform(platform) "windows"]
|
|
228
|
+
|
|
229
|
+
proc ttk::entry::NextWord {w start} {
|
|
230
|
+
variable State
|
|
231
|
+
set pos [tcl_endOfWord [$w get] [$w index $start]]
|
|
232
|
+
if {$pos >= 0 && $State(startNext)} {
|
|
233
|
+
set pos [tcl_startOfNextWord [$w get] $pos]
|
|
234
|
+
}
|
|
235
|
+
if {$pos < 0} {
|
|
236
|
+
return end
|
|
237
|
+
}
|
|
238
|
+
return $pos
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
## PrevWord -- Find the previous word position.
|
|
242
|
+
#
|
|
243
|
+
proc ttk::entry::PrevWord {w start} {
|
|
244
|
+
set pos [tcl_startOfPreviousWord [$w get] [$w index $start]]
|
|
245
|
+
if {$pos < 0} {
|
|
246
|
+
return 0
|
|
247
|
+
}
|
|
248
|
+
return $pos
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
## RelIndex -- Compute character/word/line-relative index.
|
|
252
|
+
#
|
|
253
|
+
proc ttk::entry::RelIndex {w where {index insert}} {
|
|
254
|
+
switch -- $where {
|
|
255
|
+
prevchar { expr {[$w index $index] - 1} }
|
|
256
|
+
nextchar { expr {[$w index $index] + 1} }
|
|
257
|
+
prevword { PrevWord $w $index }
|
|
258
|
+
nextword { NextWord $w $index }
|
|
259
|
+
home { return 0 }
|
|
260
|
+
end { $w index end }
|
|
261
|
+
default { error "Bad relative index $index" }
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
## Move -- Move insert cursor to relative location.
|
|
266
|
+
# Also clears the selection, if any, and makes sure
|
|
267
|
+
# that the insert cursor is visible.
|
|
268
|
+
#
|
|
269
|
+
proc ttk::entry::Move {w where} {
|
|
270
|
+
$w icursor [RelIndex $w $where]
|
|
271
|
+
$w selection clear
|
|
272
|
+
See $w insert
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
### Selection procedures.
|
|
276
|
+
#
|
|
277
|
+
|
|
278
|
+
## ExtendTo -- Extend the selection to the specified index.
|
|
279
|
+
#
|
|
280
|
+
# The other end of the selection (the anchor) is determined as follows:
|
|
281
|
+
#
|
|
282
|
+
# (1) if there is no selection, the anchor is the insert cursor;
|
|
283
|
+
# (2) if the index is outside the selection, grow the selection;
|
|
284
|
+
# (3) if the insert cursor is at one end of the selection, anchor the other end
|
|
285
|
+
# (4) otherwise anchor the start of the selection
|
|
286
|
+
#
|
|
287
|
+
# The insert cursor is placed at the new end of the selection.
|
|
288
|
+
#
|
|
289
|
+
# Returns: selection anchor.
|
|
290
|
+
#
|
|
291
|
+
proc ttk::entry::ExtendTo {w index} {
|
|
292
|
+
set index [$w index $index]
|
|
293
|
+
set insert [$w index insert]
|
|
294
|
+
|
|
295
|
+
# Figure out selection anchor:
|
|
296
|
+
if {![$w selection present]} {
|
|
297
|
+
set anchor $insert
|
|
298
|
+
} else {
|
|
299
|
+
set selfirst [$w index sel.first]
|
|
300
|
+
set sellast [$w index sel.last]
|
|
301
|
+
|
|
302
|
+
if { ($index < $selfirst)
|
|
303
|
+
|| ($insert == $selfirst && $index <= $sellast)
|
|
304
|
+
} {
|
|
305
|
+
set anchor $sellast
|
|
306
|
+
} else {
|
|
307
|
+
set anchor $selfirst
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
# Extend selection:
|
|
312
|
+
if {$anchor < $index} {
|
|
313
|
+
$w selection range $anchor $index
|
|
314
|
+
} else {
|
|
315
|
+
$w selection range $index $anchor
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
$w icursor $index
|
|
319
|
+
return $anchor
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
## Extend -- Extend the selection to a relative position, show insert cursor
|
|
323
|
+
#
|
|
324
|
+
proc ttk::entry::Extend {w where} {
|
|
325
|
+
ExtendTo $w [RelIndex $w $where]
|
|
326
|
+
See $w
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
### Button 1 binding procedures.
|
|
330
|
+
#
|
|
331
|
+
# Double-clicking followed by a drag enters "word-select" mode.
|
|
332
|
+
# Triple-clicking enters "line-select" mode.
|
|
333
|
+
#
|
|
334
|
+
|
|
335
|
+
## Press -- ButtonPress-1 binding.
|
|
336
|
+
# Set the insertion cursor, claim the input focus, set up for
|
|
337
|
+
# future drag operations.
|
|
338
|
+
#
|
|
339
|
+
proc ttk::entry::Press {w x} {
|
|
340
|
+
variable State
|
|
341
|
+
|
|
342
|
+
$w icursor [ClosestGap $w $x]
|
|
343
|
+
$w selection clear
|
|
344
|
+
$w instate !disabled { focus $w }
|
|
345
|
+
|
|
346
|
+
# Set up for future drag, double-click, or triple-click.
|
|
347
|
+
set State(x) $x
|
|
348
|
+
set State(selectMode) char
|
|
349
|
+
set State(anchor) [$w index insert]
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
## Shift-Press -- Shift-ButtonPress-1 binding.
|
|
353
|
+
# Extends the selection, sets anchor for future drag operations.
|
|
354
|
+
#
|
|
355
|
+
proc ttk::entry::Shift-Press {w x} {
|
|
356
|
+
variable State
|
|
357
|
+
|
|
358
|
+
focus $w
|
|
359
|
+
set anchor [ExtendTo $w @$x]
|
|
360
|
+
|
|
361
|
+
set State(x) $x
|
|
362
|
+
set State(selectMode) char
|
|
363
|
+
set State(anchor) $anchor
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
## Select $w $x $mode -- Binding for double- and triple- clicks.
|
|
367
|
+
# Selects a word or line (according to mode),
|
|
368
|
+
# and sets the selection mode for subsequent drag operations.
|
|
369
|
+
#
|
|
370
|
+
proc ttk::entry::Select {w x mode} {
|
|
371
|
+
variable State
|
|
372
|
+
set cur [ClosestGap $w $x]
|
|
373
|
+
|
|
374
|
+
switch -- $mode {
|
|
375
|
+
word { WordSelect $w $cur $cur }
|
|
376
|
+
line { LineSelect $w $cur $cur }
|
|
377
|
+
char { # no-op }
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
set State(anchor) $cur
|
|
381
|
+
set State(selectMode) $mode
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
## Drag -- Button1 motion binding.
|
|
385
|
+
#
|
|
386
|
+
proc ttk::entry::Drag {w x} {
|
|
387
|
+
variable State
|
|
388
|
+
set State(x) $x
|
|
389
|
+
DragTo $w $x
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
## DragTo $w $x -- Extend selection to $x based on current selection mode.
|
|
393
|
+
#
|
|
394
|
+
proc ttk::entry::DragTo {w x} {
|
|
395
|
+
variable State
|
|
396
|
+
|
|
397
|
+
set cur [ClosestGap $w $x]
|
|
398
|
+
switch $State(selectMode) {
|
|
399
|
+
char { CharSelect $w $State(anchor) $cur }
|
|
400
|
+
word { WordSelect $w $State(anchor) $cur }
|
|
401
|
+
line { LineSelect $w $State(anchor) $cur }
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
## AutoScroll
|
|
406
|
+
# Called repeatedly when the mouse is outside an entry window
|
|
407
|
+
# with Button 1 down. Scroll the window left or right,
|
|
408
|
+
# depending on where the mouse is, and extend the selection
|
|
409
|
+
# according to the current selection mode.
|
|
410
|
+
#
|
|
411
|
+
# TODO: AutoScroll should repeat faster (50ms) than normal autorepeat.
|
|
412
|
+
# TODO: Need a way for Repeat scripts to cancel themselves.
|
|
413
|
+
#
|
|
414
|
+
proc ttk::entry::AutoScroll {w} {
|
|
415
|
+
variable State
|
|
416
|
+
if {![winfo exists $w]} return
|
|
417
|
+
set x $State(x)
|
|
418
|
+
if {$x > [winfo width $w]} {
|
|
419
|
+
$w xview scroll 2 units
|
|
420
|
+
DragTo $w $x
|
|
421
|
+
} elseif {$x < 0} {
|
|
422
|
+
$w xview scroll -2 units
|
|
423
|
+
DragTo $w $x
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
## CharSelect -- select characters between index $from and $to
|
|
428
|
+
#
|
|
429
|
+
proc ttk::entry::CharSelect {w from to} {
|
|
430
|
+
if {$to <= $from} {
|
|
431
|
+
$w selection range $to $from
|
|
432
|
+
} else {
|
|
433
|
+
$w selection range $from $to
|
|
434
|
+
}
|
|
435
|
+
$w icursor $to
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
## WordSelect -- Select whole words between index $from and $to
|
|
439
|
+
#
|
|
440
|
+
proc ttk::entry::WordSelect {w from to} {
|
|
441
|
+
if {$to < $from} {
|
|
442
|
+
set first [WordBack [$w get] $to]
|
|
443
|
+
set last [WordForward [$w get] $from]
|
|
444
|
+
$w icursor $first
|
|
445
|
+
} else {
|
|
446
|
+
set first [WordBack [$w get] $from]
|
|
447
|
+
set last [WordForward [$w get] $to]
|
|
448
|
+
$w icursor $last
|
|
449
|
+
}
|
|
450
|
+
$w selection range $first $last
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
## WordBack, WordForward -- helper routines for WordSelect.
|
|
454
|
+
#
|
|
455
|
+
proc ttk::entry::WordBack {text index} {
|
|
456
|
+
if {[set pos [tcl_wordBreakBefore $text $index]] < 0} { return 0 }
|
|
457
|
+
return $pos
|
|
458
|
+
}
|
|
459
|
+
proc ttk::entry::WordForward {text index} {
|
|
460
|
+
if {[set pos [tcl_wordBreakAfter $text $index]] < 0} { return end }
|
|
461
|
+
return $pos
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
## LineSelect -- Select the entire line.
|
|
465
|
+
#
|
|
466
|
+
proc ttk::entry::LineSelect {w _ _} {
|
|
467
|
+
variable State
|
|
468
|
+
$w selection range 0 end
|
|
469
|
+
$w icursor end
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
### Button 2 binding procedures.
|
|
473
|
+
#
|
|
474
|
+
|
|
475
|
+
## ScanMark -- ButtonPress-2 binding.
|
|
476
|
+
# Marks the start of a scan or primary transfer operation.
|
|
477
|
+
#
|
|
478
|
+
proc ttk::entry::ScanMark {w x} {
|
|
479
|
+
variable State
|
|
480
|
+
set State(scanX) $x
|
|
481
|
+
set State(scanIndex) [$w index @0]
|
|
482
|
+
set State(scanMoved) 0
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
## ScanDrag -- Button2 motion binding.
|
|
486
|
+
#
|
|
487
|
+
proc ttk::entry::ScanDrag {w x} {
|
|
488
|
+
variable State
|
|
489
|
+
|
|
490
|
+
set dx [expr {$State(scanX) - $x}]
|
|
491
|
+
if {abs($dx) > $State(deadband)} {
|
|
492
|
+
set State(scanMoved) 1
|
|
493
|
+
}
|
|
494
|
+
set left [expr {$State(scanIndex) + ($dx*$State(scanNum))/$State(scanDen)}]
|
|
495
|
+
$w xview $left
|
|
496
|
+
|
|
497
|
+
if {$left != [set newLeft [$w index @0]]} {
|
|
498
|
+
# We've scanned past one end of the entry;
|
|
499
|
+
# reset the mark so that the text will start dragging again
|
|
500
|
+
# as soon as the mouse reverses direction.
|
|
501
|
+
#
|
|
502
|
+
set State(scanX) $x
|
|
503
|
+
set State(scanIndex) $newLeft
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
## ScanRelease -- Button2 release binding.
|
|
508
|
+
# Do a primary transfer if the mouse has not moved since the button press.
|
|
509
|
+
#
|
|
510
|
+
proc ttk::entry::ScanRelease {w x} {
|
|
511
|
+
variable State
|
|
512
|
+
if {!$State(scanMoved)} {
|
|
513
|
+
$w instate {!disabled !readonly} {
|
|
514
|
+
$w icursor [ClosestGap $w $x]
|
|
515
|
+
catch {$w insert insert [::tk::GetSelection $w PRIMARY]}
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
### Insertion and deletion procedures.
|
|
521
|
+
#
|
|
522
|
+
|
|
523
|
+
## PendingDelete -- Delete selection prior to insert.
|
|
524
|
+
# If the entry currently has a selection, delete it and
|
|
525
|
+
# set the insert position to where the selection was.
|
|
526
|
+
# Returns: 1 if pending delete occurred, 0 if nothing was selected.
|
|
527
|
+
#
|
|
528
|
+
proc ttk::entry::PendingDelete {w} {
|
|
529
|
+
if {[$w selection present]} {
|
|
530
|
+
$w icursor sel.first
|
|
531
|
+
$w delete sel.first sel.last
|
|
532
|
+
return 1
|
|
533
|
+
}
|
|
534
|
+
return 0
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
## Insert -- Insert text into the entry widget.
|
|
538
|
+
# If a selection is present, the new text replaces it.
|
|
539
|
+
# Otherwise, the new text is inserted at the insert cursor.
|
|
540
|
+
#
|
|
541
|
+
proc ttk::entry::Insert {w s} {
|
|
542
|
+
if {$s eq ""} { return }
|
|
543
|
+
PendingDelete $w
|
|
544
|
+
$w insert insert $s
|
|
545
|
+
See $w insert
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
## Backspace -- Backspace over the character just before the insert cursor.
|
|
549
|
+
# If there is a selection, delete that instead.
|
|
550
|
+
# If the new insert position is offscreen to the left,
|
|
551
|
+
# scroll to place the cursor at about the middle of the window.
|
|
552
|
+
#
|
|
553
|
+
proc ttk::entry::Backspace {w} {
|
|
554
|
+
if {[PendingDelete $w]} {
|
|
555
|
+
See $w
|
|
556
|
+
return
|
|
557
|
+
}
|
|
558
|
+
set x [expr {[$w index insert] - 1}]
|
|
559
|
+
if {$x < 0} { return }
|
|
560
|
+
|
|
561
|
+
$w delete $x
|
|
562
|
+
|
|
563
|
+
if {[$w index @0] >= [$w index insert]} {
|
|
564
|
+
set range [$w xview]
|
|
565
|
+
set left [lindex $range 0]
|
|
566
|
+
set right [lindex $range 1]
|
|
567
|
+
$w xview moveto [expr {$left - ($right - $left)/2.0}]
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
## Delete -- Delete the character after the insert cursor.
|
|
572
|
+
# If there is a selection, delete that instead.
|
|
573
|
+
#
|
|
574
|
+
proc ttk::entry::Delete {w} {
|
|
575
|
+
if {![PendingDelete $w]} {
|
|
576
|
+
$w delete insert
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
#*EOF*
|