]> git.entuzijast.net Git - imunes.git/commitdiff
Undo/Redo disabled in Edit menu if there is nothing to undo or redo.
authormiljenko <miljenko>
Mon, 26 Mar 2007 11:32:28 +0000 (11:32 +0000)
committermiljenko <miljenko>
Mon, 26 Mar 2007 11:32:28 +0000 (11:32 +0000)
Fixed undo for "Allign to grid"

Bug found by:
Submitted by:
Requested by:
Reviewed by:
Approved by:
Obtained from:

editor.tcl
exec.tcl
initgui.tcl

index ef8b4851fc939040a98888b18bef4b5b5edbdcdf..9362e6bf06356ee3fd8d07b6c1933530ca48b6e1 100755 (executable)
@@ -149,6 +149,9 @@ proc updateUndoLog {} {
        set t_undolog ""
        dumpCfg string t_undolog
        incr undolevel
+        if { $undolevel == 1 } {
+            .menubar.edit entryconfigure "Undo" -state normal 
+        }
        set undolog($undolevel) $t_undolog
        set redolevel $undolevel
        set changed 0
@@ -169,7 +172,11 @@ proc undo {} {
     global undolevel undolog oper_mode
 
     if {$oper_mode == "edit" && $undolevel > 0} {
+        .menubar.edit entryconfigure "Redo" -state normal 
        incr undolevel -1
+        if { $undolevel == 0 } {
+            .menubar.edit entryconfigure "Undo" -state disabled 
+        }
        .c config -cursor watch
        loadCfg $undolog($undolevel)
        switchCanvas none
@@ -193,6 +200,12 @@ proc redo {} {
 
     if {$oper_mode == "edit" && $redolevel > $undolevel} {
        incr undolevel
+        if { $undolevel == 1 } {
+            .menubar.edit entryconfigure "Undo" -state normal 
+        }
+        if {$redolevel <= $undolevel} {
+            .menubar.edit entryconfigure "Redo" -state disabled 
+        }
        .c config -cursor watch
        loadCfg $undolog($undolevel)
        switchCanvas none
@@ -2608,7 +2621,7 @@ proc deleteSelection { } {
 
 
 proc align2grid {} {
-    global sizex sizey grid zoom
+    global sizex sizey grid zoom changed
 
     set node_objects [.c find withtag node]
     if { [llength $node_objects] == 0 } {
index 5ce969335bc78426f4438e389c43a7b721f665c5..560b7f752ccc85b32200da99e9d77156f59449c8 100755 (executable)
--- a/exec.tcl
+++ b/exec.tcl
@@ -141,6 +141,7 @@ proc setOperMode { mode } {
     global oper_mode activetool node_list
     global nmbufs nmbclusters
     global editor_only remote_exec execSock
+    global undolevel redolevel
 
     if { $mode == "exec" } { ;# let's try something, sockets should be opened
         nexec id -u
@@ -214,8 +215,16 @@ proc setOperMode { mode } {
            .menubar.experiment entryconfigure "Execute" -state normal
        }
        .menubar.experiment entryconfigure "Terminate" -state disabled
-       .menubar.edit entryconfigure "Undo" -state normal
-       .menubar.edit entryconfigure "Redo" -state normal
+       if { $undolevel > 0 } {
+            .menubar.edit entryconfigure "Undo" -state normal
+        } else {
+            .menubar.edit entryconfigure "Undo" -state disabled
+        }
+        if { $redolevel > $undolevel } {
+            .menubar.edit entryconfigure "Redo" -state normal
+        } else {
+            .menubar.edit entryconfigure "Redo" -state disabled
+        }
        set oper_mode edit
        remoteClose
     }
index c470a76781899fa9a39756e528e3f9d5415a19b8..b018e12f92df40f52a44ff0d7d1b03e2c07ef261 100755 (executable)
@@ -212,10 +212,10 @@ bind . <Control-s> "fileSaveDialogBox"
 #
 menu .menubar.edit -tearoff 0
 .menubar.edit add command -label "Undo" -underline 0 \
-    -accelerator "Ctrl+Z" -command undo
+    -accelerator "Ctrl+Z" -command undo -state disabled
 bind . <Control-z> undo
 .menubar.edit add command -label "Redo" -underline 0 \
-    -accelerator "Ctrl+Y" -command redo
+    -accelerator "Ctrl+Y" -command redo -state disabled
 bind . <Control-y> redo
 .menubar.edit add separator
 .menubar.edit add command -label "Select all" \