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
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
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
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 } {
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
.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
}
#
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" \