aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2012-12-20 03:30:39 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2012-12-20 03:30:39 +0000
commit8d9a3ecc38bcbfe3594613f238a5c0cd88579a36 (patch)
tree8ef6fcd1d7ced7598f0b5faf1821bb6baa07300c
parentd9398eace7a59e62ebfcae277a87304f435a15b7 (diff)
simple version of editmode_look
svn path=/trunk/scripts/guiplugins/simple_examples/; revision=16714
-rw-r--r--editmode_background_color-plugin.tcl28
1 files changed, 28 insertions, 0 deletions
diff --git a/editmode_background_color-plugin.tcl b/editmode_background_color-plugin.tcl
new file mode 100644
index 0000000..59b4970
--- /dev/null
+++ b/editmode_background_color-plugin.tcl
@@ -0,0 +1,28 @@
+# this script makes it so that the cords are hidden when not in edit mode
+
+namespace eval ::editmode_look {
+ # array of the original background colors for each window
+ array set original_color {}
+}
+
+proc ::editmode_look::set_cords_by_editmode {mytoplevel eventname} {
+ variable original_color
+ if {$mytoplevel eq ".pdwindow"} {return}
+ set tkcanvas [tkcanvas_name $mytoplevel]
+ # if the mytoplevel sent to us doesn't currently have a window, silently quit
+ if { ! [winfo exists $mytoplevel] } {return}
+ # if the array doesn't have this instance, get the current color
+ if {[array get original_color $mytoplevel] eq ""} {
+ set original_color($mytoplevel) [$tkcanvas cget -background]
+ }
+ if {$::editmode($mytoplevel) == 1} {
+ # store the background color, in case its been changed
+ set original_color($mytoplevel) [$tkcanvas cget -background]
+ $tkcanvas configure -background "lightblue"
+ } else {
+ $tkcanvas configure -background $original_color($mytoplevel)
+ }
+}
+
+bind PatchWindow <<EditMode>> {+::editmode_look::set_cords_by_editmode %W editmode}
+bind PatchWindow <<Loaded>> {+::editmode_look::set_cords_by_editmode %W loaded}