Returns information about all undo, or redo, atoms. If stack is specified (must be either undo or redo), then only the information of this stack will be returned, otherwise the result contains two lists, firstly all undo atoms, and secondly all redo atoms. Any atom information contains at least one sub-atom.
This is an informal description about the sub-atom content:{clear}
Redo clearing tag associations (tag clear).
{clear <tag-list> <skip> <length> ...}
Undo clearing tag associations (tag clear).
{delete}
Redo the deletion either of characters, hyphen, embedded image, or embedded window (delete).
{delete character <string> <tag-list>}
Undo the deletion of characters (delete), does not contain soft hyphens.
{delete hyphen <tag-list>}
Undo the deletion of a soft hyphen (delete).
{delete image <tag-list> <image-options>}
Undo the deletion of an embedded image (delete).
{delete window <tag-list> <window-options>}
Undo the deletion of an embedded window (delete).
{insert}
Undo an insert operation; either characters, hyphen, embedded image, or embedded window.
{insert character <string> <tag-list>}
Redo an insert operation of characters.
{insert hyphen <tag-list>}
Redo an insert operation of a soft hyphen.
{insert image <tag-list> <image-options>}
Redo an insert operation of an embedded image.
{insert window <tag-list> <window-options>}
Redo an insert operation of an embedded window.
{mark gravity <name>}
Undo/redo toggling the gravity of a mark; either from left to right, or from right to left (tag gravity).
{mark set <name> left}
Undo/redo setting a mark with left gravity (mark set).
{mark set <name> right}
Undo/redo setting a mark with right gravity (mark set).
{mark unset <name>}
Undo/redo unsetting a mark (mark unset).
{tag add <tag>}
Undo/redo adding an association with tags (tag add).
{tag remove <tag>}
Undo/redo removing an association with tags (tag delete).
Below is a demonstration for edit inspect, this demonstration is also a good example for the capability of the new undo/redo mechanism. Note that this is only a demonstration for undo/redo, it is intended that selecting one of the display options do not have effects. This script also demonstrates the use of new option -maxredo.
set King [image create photo -data {
iVBORw0KGgoAAAANSUhEUgAAAA8AAAAQCAQAAABjX+2PAAABBklEQVQYGQXBy4rNAQDA4e/8j+Po
ZMbOuJSFpdKUpctmsrCbB+AJFK9gMjW5HCwYmbCxcCk7SdlObDQsyIZkIdnJE/x8nyRJksTI2G4z
i5IkcdDFxMjYxB57JUnipg+WY2Swy9RMksSCN95bSQzGJqYSM3Pb7po7bdMr78wtGptIvHDByHlP
rfrmsMFlzw3GYup3Eg9csZoY+2diEBN/jRKXfDVJHPE9kXjrTOK410ncdy2ROGrbUuzzOLHii4VE
Eid9dt1DP2zZ8MuxJJLEJ+ecsuyEsz4miSQGf7z0xCNb7vlplEQS++246pY7blu3YymJJA555oYN
69as2XQgiSRJkiRJ8h90q586PuhdBQAAAABJRU5ErkJggg==
}]
set Queen [image create photo -data {
iVBORw0KGgoAAAANSUhEUgAAAA8AAAAQCAQAAABjX+2PAAABGUlEQVQY023PPUtbARQG4OeSGJvU
VishBQu2UBCH6uLo0OggOLgEGiREW9raRoNkCCJcVCi0IAQzdqhxcQpEJX4Q/AH+Dgf/yHWokUbL
O5zD+8CBQ0bakAFP9IkJIv+GtGGDUvrFPTUn0csvDBqQ9N2MPUWrMtY87/IzGVNSztRNuvbGL1+E
XU5q+2PWlpKYG4EZ5yY1fIqQUHLtpQ9aXjv1yg+ht06UIsTEhOrea1uwLqvmoxXlv8cDgTFXvqro
GNOUs6JtJBLpPtCyq+BIoCPrp527/m5U5Gw7UFWzZtS3Xk5oyhv3zoRpl1I9HNGwbNG8vLKL+/Z+
+a2opKKs4PAx75uVt+yzJcfiD3nXhqpNodCO9AP+f24B1U6LKboJa54AAAAASUVORK5CYII=
}]
set Rook [image create photo -data {
iVBORw0KGgoAAAANSUhEUgAAAA8AAAAQCAQAAABjX+2PAAAAx0lEQVQY042Qz8pBARDFf8efqJsi
3b6dJA+grHgBZacsvjeQ+spO3kRZyUZK2Vva2FjYWSgvYGUhFlfzLXDdq9zMLGaa05wzc2RERSwS
JXEvapKxmRq4nG2hFnGbB2CqOMpRo8dAPxS5MAfQXVsjDiHWiv0GtbsUAA8PjxslOiFtu2lJ1sYA
qnCx0+fLFf3Y93Ai0CWVBiD1WnrakqfNhr/HtCzXjj65HNZsufq5Z6Ksb4uG1NmF9IusrP8kF9O3
87a4AVM/xT9UUy9ni4CuvQAAAABJRU5ErkJggg==
}]
set Bishop [image create photo -data {
iVBORw0KGgoAAAANSUhEUgAAAA8AAAAQCAQAAABjX+2PAAAAz0lEQVQY033RrUqDYRgG4MuNMRnY
BGUgiGFVBlZlWSwyXbbNv/CpYFSDSYvFnwPQZBFF8WNpoMjiBDHIzsEzeA1a9n5z3OnhKvfDLRiW
/mPGwjB+cmn6H1Z150xjIFvWMhZYcS0fsUk94+adBnbsx7xpz6Ev394Uvca8LVG2LlWR04l5Sk9Z
3mhgzXG2WsOHtnfPUoUsV20oGAncDnoscSVx4MSnXB8rWbRq14Ouc7Nq5hT/WFNbx6MXF+putKS6
7i398pFaZqkJW+rRJNn8ADg/uxlFka/jAAAAAElFTkSuQmCC
}]
set Knight [image create photo -data {
iVBORw0KGgoAAAANSUhEUgAAAA8AAAAQCAQAAABjX+2PAAAA1ElEQVQY033RTyuEURQH4Id3In9G
UUopO2WDLDTmA1irSUpWVhY0piwsLX0A0qSm2I2ynCbKN5gvYid7dSzmxZ2X0dnc01P3nvO7wn81
2EwMZTtW3NgbxhUPzrRs/8EmNVWDZS3PykWuqzvJz8c6RhI26s64UrBlOmg6TfnAbt5eqwRzXk39
cLt/mSU9myF4tJ+zNZcy6y4c6poJQcPtF5ecO3Iv01DLH6nqpaNtmLfq6nuhBW+FUHX644Qg82Es
TW3Wy0Be78opL+pqJ/UkK/zY7/oE/Cy3FaAsiDgAAAAASUVORK5CYII=
}]
set Pawn [image create photo -data {
iVBORw0KGgoAAAANSUhEUgAAAA8AAAAQCAQAAABjX+2PAAAAuElEQVQY033QzwoBURTH8S/lT5SU
nY1pptkoYScLWciGmoWVeQHK1oYHsPIEkhhiaeMBlKS8CEtLO3Sb5g939Fuc0/0szjmXF//ibUO0
UYLZpMMsmA0KTAOYMH3qdCnLeUBT1DkpGe9JijqkIeMJphhxRJVxnjtZxuyI/PBn6wOa6IpsqfiY
GldizlOCCxkvn2j5zukxcpg0T6I+znF2ucoNHQ0VxY7Ow+USC5assFizsWMR//pzWd7Qd77lxwI7
ngAAAABJRU5ErkJggg==
}]
set king [image create photo -data {
iVBORw0KGgoAAAANSUhEUgAAAA8AAAAQCAQAAABjX+2PAAABBElEQVQY03XRzSvkARgH8M/WXrV/
gsveppyVCzm5ue5FpNZli5LGxYaDvJSluXCy4sBFjZoIOWjlYpuMl4a81jLtgeSglHocJPNjt+/p
2+fw9DyPUB49b3qitCr59n/+6q/md+yDBp1qFAxaUue7NhWvPGvFgBWH5h3bNCVjx6cgqHalW8g6
0uvST+HWmPQzf7FgQwgzZox7FEKvH8+cUjAhhAlhWAhnpjW+zM7p8CBMejAqhD77Pr5wpaI+u/pd
67JuSF6qbG+17uw5F0oKTqQTZ/HZH2MyMkb029CS5Cr3DuTMydpyoT3J9X5Zc+FGSd6q4SRXW7at
6FTRb4ua/vGS93kCmHvAh5881pMAAAAASUVORK5CYII=
}]
set queen [image create photo -data {
iVBORw0KGgoAAAANSUhEUgAAAA8AAAAQCAQAAABjX+2PAAABAklEQVQY023QvysEcBzG8VcoA8Ki
TAaSxYTFf0ChyMxGJxKyMCnJIINfZZD8WORuQd1ikAmlWCwKg47yI8pN3Nfg192lZ/k8vev5fJ6P
IF3K5GX436FehRYpa4EaxWlYnkrBkSrX+tVKOf3FYl5U2jMQ2Neg0L0+XebkCKx7VGJENHCjU7VE
4ERK+VfEqmbdkkp9GDXhWK64mp/dLW60C8YFSy5tG7Hxd1q+V7uCJ0FCsCOpI62YzYz6KW8K0nGj
dxc2zJoXc2ch+y1xqw6du3LmQGs2jhkyacWSaVuasvGJMb16RAyKasvACj14/jYfbkUycZFhU+Ys
WzRjWF1W+P/6BMT1tuyff57gAAAAAElFTkSuQmCC
}]
set rook [image create photo -data {
iVBORw0KGgoAAAANSUhEUgAAAA8AAAAQCAQAAABjX+2PAAAAvElEQVQY06WQOwrCUBBFz4RUfho/
AUWw1hVI9uIqXICuQQSbFIJLsBVsLCzdgCASrP2AWnktEh9R1MaZ4t33LnPmzZj4FX5yWJm8dhZQ
Ao4caLLVDRBCEHGlzRQhFvQQHSEsgduY4gu1Sl8r8NLrjJA6hTRbnNmCgwtCJ8WBXPrq7ErGjp/C
+znXn7bvVMjG6bvVtc9UW5cJvssCkdUAt5aY0Qs14KRBatuSK/bW9sJcw6T3msaHf8UO/i0eiklJ
2MsDcp4AAAAASUVORK5CYII=
}]
set bishop [image create photo -data {
iVBORw0KGgoAAAANSUhEUgAAAA8AAAAQCAQAAABjX+2PAAAA0ElEQVQY03XRvyuEARgH8M8ppQym
s1BiVKf8B3YD42syiOlmm/U6i24hg002kuUmGUxSJxnYTG8ZnAxXchc9BoZ7f+g7ffvU07ceYThG
cj1T2t7M/c+XBqZLWUVTCHdmy/hA6LoVuuZzbFW4saPm1IeOSpabQsuSSYlXYTTLdSE82RNCmj8+
5mFo8FZxWs2nvtDzWLZ8zYWGI9s6Joq87tm5M233qhk2ZUPdpivv9i1atmLmjx0bSL3ou5ZIfev5
Eg5/+cRC9k/BuMRu7iXF/ACi7MlsffkhcQAAAABJRU5ErkJggg==
}]
set knight [image create photo -data {
iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAQAAACR313BAAAAyElEQVQY02P4zwCCDMoMEgzhDDUQ
HgLCKFWGNwwrGH4yaGGXtmP4AGZsZpjNwIUmzaDE8INhMZj5laGPYSMDO6p0CcNHoNEQkV8MtQwL
kaQZ+ID2wvi3gfguwwQGR4R0LZJbjoHJKoYFUGkGJoaHDO+gks+g9AGGDQzMEGl+hosMj4GsSQxS
DPuh0j+AxuvDDLdiOARUzciQjWTJJIYoJH8DGWpATyGkp0JCECG9CCW4ehgmoUrfQJFuYZiFKt3J
MAMFhqNIY4cALJe82fOl3HwAAAAASUVORK5CYII=
}]
set pawn [image create photo -data {
iVBORw0KGgoAAAANSUhEUgAAAA8AAAAQCAQAAABjX+2PAAAApElEQVQY033RvQkCQRDF8f8sp4F4
cKkgmClGtmAkCNZgbjVWIBzYhAVcCYImFmB4Ddwzkf1gl9tNHvNj4MGYGHsuRFtaZ625xOU/F4TY
Kp5FcUPPk2mRWfNFiAdW4tbHQ+BQpPGpLlTjxIAQH5ps22YcGQCYcLYq2WZOR1z4nlTjmqAQe89U
9BnfAu8yFO9QbVW4xX9mwmoWOAyHeR54SWDjB/0B2+iDewRXhcMAAAAASUVORK5CYII=
}]
set style "cql"
proc Button {w id txt} {
ttk::frame $w.$id -borderwidth 1 -relief raised
ttk::radiobutton $w.$id.b \
-text $txt \
-variable style \
-width 20 \
-value $id \
-cursor left_ptr \
;
pack $w.$id.b
return $w.$id;
}
proc ShowPiece {img letter descr} {
.t image create end -image $img
.t insert end "\t=\t" {} $letter bold "\t=\t$descr\n"
}
proc ShowStack {stack tag} {
foreach atom $stack {
foreach sub $atom {
set type [lindex $sub 0]
if {[lindex $sub 0] in {tag mark}} {
.u insert end $type $tag "\n " {} [lrange $sub 1 end] {} "\n"
} else {
set indent ""; set fg $tag
foreach elem $sub {
.u insert end $indent {} [string map {\n \\n \t \\t} $elem] $fg "\n"
set indent " "; set fg ""
}
}
}
}
}
proc Inspect {} {
.u delete begin end
lassign [.t edit inspect] undo redo
if {[llength $undo] + [llength $redo] == 0} {
.u insert end "<stack is empty>" lite
} else {
ShowStack $undo red
ShowStack $redo green
.u delete end-1c
}
}
set serif [list [font configure TkTextFont -family] -14]
set bold [list [font configure TkTextFont -family] -14 bold]
set sansserif [list [font configure TkFixedFont -family] -12]
ttk::style configure TRadiobutton -font $serif
set gravity right
text .t -font $serif -background white -width 70 -padx 5 -pady 5 -insertwidth 2 -insertofftime 0
text .u -font $sansserif -wrap none -height 14 -state readonly
.t configure -steadymarks on -wrap word
.u configure -yscrollcommand { .v set }
.u configure -xscrollcommand { .h set }
.t configure -tabs {16 left} -tabstyle wordprocessor
.t tag configure bold -font $bold
.u tag configure lite -foreground #555555
.u tag configure red -foreground darkred
.u tag configure green -foreground darkgreen
ttk::scrollbar .h -orient horizontal -command { .u xview }
ttk::scrollbar .v -orient vertical -command { .u yview }
ttk::frame .c -relief sunken -borderwidth 1
ttk::button .c.undo -text "Undo" -command { catch { .t edit undo }; focus .t }
ttk::button .c.redo -text "Redo" -command { catch { .t edit redo }; focus .t }
ttk::button .c.separator -text "Separator" -command {
.t edit separator -immediately
focus .t
}
ttk::button .c.reset -text "Reset" -command {
.t edit recover
set gravity right
.c.gravity configure -text "Left"
focus .t
}
ttk::button .c.bold -text "Bold" -command {
catch { .t tag add bold sel.first sel.last }
focus .t
}
ttk::button .c.normal -text "Normal" -command {
catch { .t tag remove bold sel.first sel.last }
focus .t
}
ttk::button .c.clear -text "Clear" -command {
catch { .t tag clear sel.first sel.last }
focus .t
}
ttk::button .c.set -text "Set" -command {
.t mark set m1 current $::gravity
focus .t
}
ttk::button .c.unset -text "Unset" -command {
.t mark unset m1
focus .t
}
ttk::button .c.gravity -text "Left" -command {
.c.gravity configure -text [string totitle $::gravity]
if {$::gravity eq "left"} { set ::gravity "right" } else { set ::gravity "left" }
if {[.t mark exists m1]} { .t mark gravity m1 $::gravity }
focus .t
}
ttk::label .c.tags -text "Tags: "
ttk::label .c.marks -text "Marks: "
ttk::label .c.edit -text "Stack: "
grid .c.tags -row 0 -column 0 -sticky w
grid .c.bold -row 0 -column 1
grid .c.normal -row 0 -column 2
grid .c.clear -row 0 -column 3
grid .c.marks -row 1 -column 0 -sticky w
grid .c.set -row 1 -column 1
grid .c.unset -row 1 -column 2
grid .c.gravity -row 1 -column 3
grid .c.edit -row 2 -column 0 -sticky w
grid .c.undo -row 2 -column 1
grid .c.redo -row 2 -column 2
grid .c.separator -row 2 -column 3
grid .c.reset -row 2 -column 4
grid .t -row 0 -column 0 -columnspan 2 -sticky ew
grid .c -row 1 -column 0 -columnspan 2 -sticky ew
grid .u -row 2 -column 0 -sticky nsew
grid .v -row 2 -column 1 -sticky ns
grid .h -row 3 -column 0 -columnspan 2 -sticky ew
grid rowconfigure . {2} -weight 1
grid columnconfigure . {0} -weight 1
.t insert end "Per default graphical figurine for the notation of chess "
.t insert end "pieces will be used, due to internalization reasons. The "
.t insert end "CQL editor is also working with graphical figurine, although "
.t insert end "the CQL files will be saved with the corresponding English "
.t insert end "letters:\n\n"
ShowPiece $King "K" "white king"
ShowPiece $Queen "Q" "white queen"
ShowPiece $Rook "R" "white rook"
ShowPiece $Bishop "B" "white bishop"
ShowPiece $Knight "N" "white knight"
ShowPiece $Pawn "P" "white pawn"
ShowPiece $king "k" "black king"
ShowPiece $queen "q" "black queen"
ShowPiece $rook "r" "black rook"
ShowPiece $bishop "b" "black bishop"
ShowPiece $knight "n" "black knight"
ShowPiece $pawn "p" "black pawn"
.t insert end "\n"
.t insert end "Please select the preferred display option:\n\n"
.t window create end -create { Button %W cql "Use graphical figurine" }
.t insert end " "
.t image create end -image $King; .t insert end " "
.t image create end -image $Queen; .t insert end " "
.t image create end -image $Rook; .t insert end " "
.t image create end -image $Bishop; .t insert end " "
.t image create end -image $Knight; .t insert end " "
.t image create end -image $Pawn; .t insert end " "
.t image create end -image $king; .t insert end " "
.t image create end -image $queen; .t insert end " "
.t image create end -image $rook; .t insert end " "
.t image create end -image $bishop; .t insert end " "
.t image create end -image $knight; .t insert end " "
.t image create end -image $pawn; .t insert end "\n\n"
.t window create end -create { Button %W english "Use English piece letters" }
.t insert end " K Q R B N P k q r b n p (will be used in CQL files)"
.t configure -undo on
.t mark set insert begin
.t mark set current begin
# Under Linux we also want Ctrl-Y for redo operation.
bind .t <Control-y> { catch { .t edit redo }; break }
bind .t <Control-Y> { catch { .t edit redo }; break }
bind .t <<UndoStack>> { Inspect }
Inspect
focus .t