Error processing request

Parameters

CONTENT_LENGTH0
REQUEST_METHODGET
REQUEST_URI/revision/Advent+Wreath?V=8
QUERY_STRINGV=8
CONTENT_TYPE
DOCUMENT_URI/revision/Advent+Wreath
DOCUMENT_ROOT/var/www/nikit/nikit/nginx/../docroot
SCGI1
SERVER_PROTOCOLHTTP/1.1
HTTPSon
REMOTE_ADDR108.162.216.15
REMOTE_PORT35248
SERVER_PORT4443
SERVER_NAMEwiki.tcl-lang.org
HTTP_HOSTwiki.tcl-lang.org
HTTP_CONNECTIONKeep-Alive
HTTP_ACCEPT_ENCODINGgzip, br
HTTP_X_FORWARDED_FOR3.15.190.144
HTTP_CF_RAY878dec762c691b68-ORD
HTTP_X_FORWARDED_PROTOhttps
HTTP_CF_VISITOR{"scheme":"https"}
HTTP_ACCEPT*/*
HTTP_USER_AGENTMozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; [email protected])
HTTP_CF_CONNECTING_IP3.15.190.144
HTTP_CDN_LOOPcloudflare
HTTP_CF_IPCOUNTRYUS

Body


Error

Unknow state transition: LINE -> END

-code

1

-level

0

-errorstack

INNER {returnImm {Unknow state transition: LINE -> END} {}} CALL {my render_wikit {Advent Wreath} \[HJG\]\ 2008-12\ This\ program\ simulates\ the\ candles\ burning\ down\ on\ an\ advent-wreath,\ \nand\ keeps\ track\ of\ statistics,\ such\ as\ how\ many\ times\ each\ candle\ was\ lit,\nand\ how\ many\ times\ each\ advent\ was\ celebrated.\nEvery\ time\ 'burn'\ is\ selected,\ the\ candles\ are\ burned\ for\ certain\ time,\ e.g.\ one\ hour.\n\nSo\ you\ can\ try\ to\ maximize\ the\ usage\ you\ might\ get\ out\ of\ a\ set\ of\ candles...\n\n======\n#!/bin/sh\n#\ Restart\ with\ tcl:\ -*-\ mode:\ tcl\;\ tab-width:\ 4\;\ -*-\ \\\n\ exec\ wish\ \$0\ \$\{1+\"\$@\"\}\n\n#\ http://wiki.tcl.tk/20479\ -\ advent20.tcl\ -\ 2009-01-10\n#\ Simulate\ an\ advent-wreath:\ select\ which\ candles\ to\ light,\ press\ button\ to\ burn\n\n#\ 1.1\ \ 2008-12-21:\ log\ to\ console\n#\ 1.2\ \ 2008-12-22:\ wick\n#\ 1.3\ \ 2008-12-23:\ bind,\ Click,\ tk_optionMenu\ for\ initial\ length\ of\ candles\n#\ 1.4\ \ 2008-12-24:\ Click,\ CountButtons,\ CheckButtons\ :\ \n#\ \ \ \ click\ on\ candle\ to\ toggle\ checkbox\ +\ update\ text\ on\ \"Burn\"-button\ \n#\ 1.5\ \ 2008-12-25:\ len\ ->\ burncount,\ Flame/Smoke\n#\ 1.6\ \ 2008-12-26:\ code\ cleanup\n#\ 1.7\ \ 2008-12-27:\ smoke,\ inner+outer\ flame\ \n#\ 1.9\ \ 2009-01-09:\ Menu,\ Options/candle-colors\n#\ 2.0\ \ 2009-01-10:\ Hotkeys\ for\ checkbuttons\n\n\n#\ Todo:\ \n#\ *\ variable\ number\ of\ candles/checkbuttons/stats-displays\n#\ *\ allow\ initial\ state\ with\ candles\ of\ different\ length\n#\ *\ load/save\ -\ F3\n#\ *\ delete+redraw\ -->\ itemconfig\n#\ *\ show\ stats\ on\ candle/holder:\ current\ len,\ burn-count\n#\ *\ disable\ checkboxes\ of\ burnt-out\ candles\n#\ *\ use\ grid\ for\ positioning\ the\ candles\n#\ *\ candleflames\ +\ animation\n\n#\ *\ icon\ in\ program\ itself:\ include\ data\ for\ iconbitmap\n#\ *\ selfrunning\ Demo\n#\ ...\n\n\n\ package\ require\ Tk\n\n\ global\ Prg\n\n\ set\ Prg(Title)\ \ \ \ \"Advent-Wreath\"\n\ set\ Prg(Version)\ \ \"v2.0\"\n\ set\ Prg(Date)\ \ \ \ \ \"2009-01-10\"\n\ set\ Prg(Author)\ \ \ \"Hans-Joachim\ Gurt\"\n\ set\ Prg(Contact)\ \ \[string\ map\ -nocase\ \{:\ @\ !\ .\}\ gurt:gmx!de\]\n\ set\ Prg(About)\ \ \ \ \"Simulates\ the\ candles\ on\ an\ advent-wreath:\\nselect\ which\ candles\ to\ light,\ press\ button\ to\ burn\ one\ slice.\"\n\n\ proc\ ClrCanvas\ \{w\}\ \{\n\ \ \ \$w\ delete\ \"all\"\n\ \}\n\n\ proc\ decr\ \{x\ y\}\ \{\ expr\ \$x\ -\ \$y\ \}\n\n\n#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+\n\n\n\ proc\ About\ \{\}\ \{\n\ #:\ Short\ info\ about\ the\ program\n\ \ \ global\ Prg\n\ \ \ set\ txt\ \ \ \ \"\$Prg(Title)\ \$Prg(Version)\ -\ \"\n\ \ \ append\ txt\ \"\$Prg(Date)\\nby\ \$Prg(Author)\ -\ \$Prg(Contact)\\n\\n\$Prg(About)\"\n\ \ \ tk_messageBox\ -icon\ info\ -message\ \$txt\ -title\ \"About\ \$Prg(Title)\ \$Prg(Version)\"\n\ \}\n\n\n\ proc\ InitMenu\ \{\}\ \{\n\ #:\ Install\ menu\n\ \ \ option\ add\ *Menu.tearOff\ 0\n\n\ \ \ .\ config\ -menu\ \[menu\ .menu\]\n\n\ \ \ menu\ .menu.game\n\ \ \ .menu\ add\ cascade\ -label\ \"File\"\ -underline\ 0\ -menu\ .menu.game\n\n\ \ \ .menu.game\ add\ command\ -label\ \"New\"\ -command\ \{\ Init\ .c1\ \}\ -underline\ 0\ \\\n\ \ \ \ \ \ \ -accelerator\ \"F5\"\n\ \ \ .menu.game\ add\ command\ -label\ \"Burn\"\ -command\ \{\ Burn\ .c1\ \}\ -underline\ 0\ \\\n\ \ \ \ \ \ \ -accelerator\ \"F6\"\n\ \ \ .menu.game\ add\ separator\n\ \ \ .menu.game\ add\ command\ -label\ \"Exit\"\ -underline\ 1\ -command\ exit\ \\\n\ \ \ \ \ \ \ -accelerator\ \"F4\"\n\n\ \ \ menu\ .menu.opt\n\ \ \ .menu\ add\ cascade\ -label\ \"Options\"\ -underline\ 0\ -menu\ .menu.opt\n\n\ \ \ .menu.opt\ add\ cascade\ -label\ \"Color\"\ -menu\ .menu.opt.col\ -underline\ 0\n\n\ \ \ menu\ .menu.opt.col\n\ \ \ foreach\ \{cn\ cv\}\ \[list\ \ Red\ red2\ \ Pink\ HotPink1\ \ Yellow\ Yellow1\ \ Beewax\ goldenrod\ \ Green\ green3\ \ Blue\ CadetBlue2\ \ White\ beige\ \]\ \{\n\ \ \ \ \ \ \ .menu.opt.col\ add\ radio\ -label\ \$cn\ \\\n\ \ \ \ \ \ \ \ \ \ \ -variable\ ::candle(cC)\ \\\n\ \ \ \ \ \ \ \ \ \ \ -value\ \$cv\ \\\n\ \ \ \ \ \ \ \ \ \ \ -underline\ 0\ \\\n\ \ \ \ \ \ \ \ \ \ \ -command\ \{\ Init\ .c1\ \}\n\ \ \ \}\n\n\ \ \ .menu.opt\ add\ cascade\ -label\ \"Length\"\ -menu\ .menu.opt.len\ -underline\ 0\n\ \ \ menu\ .menu.opt.len\n\ \ \ for\ \{\ set\ i\ 2\ \}\ \{\ \$i\ <=\ 20\ \}\ \{\ incr\ i\ 1\ \}\ \{\n\ \ \ \ \ \ \ .menu.opt.len\ add\ radio\ -label\ \"\$i\"\ \\\n\ \ \ \ \ \ \ \ \ \ \ -variable\ ::candle(iC)\ \ -value\ \$i\ \\\n\ \ \ \ \ \ \ \ \ \ \ -command\ \{\ Init\ .c1\ \}\n\ \ \ \}\n\n\ \ \ menu\ .menu.help\n\ \ \ .menu\ add\ cascade\ -label\ \"Help\"\ -underline\ 0\ -menu\ .menu.help\n\ \ \ .menu.help\ add\ command\ -label\ \"About\"\ -underline\ 0\ -command\ About\\\n\ \ \ \ \ \ \ -accelerator\ \"F1\"\n\ \ \ .menu.help\ add\ separator\n\ \ \ .menu.help\ add\ command\ -label\ \"Console\"\ -underline\ 0\ -command\ \{\ console\ show\ \}\ \\\n\ \ \ \ \ \ \ -accelerator\ \"F2\"\n\n\ \ \ bind\ all\ <Key-F1>\ About\n\ \ \ bind\ all\ <Key-F4>\ exit\n\ \ \ bind\ all\ <Key-F5>\ \{\ Init\ .c1\ \}\n\ \ \ bind\ all\ <Key-F6>\ \{\ Burn\ .c1\ \}\n\ \}\n\n\n#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+\n\n\n\ proc\ DrawCandle\ \{w\ nr\}\ \{\n\ #:\ Draw\ one\ of\ the\ candles\ /\ calculate\ its\ position\ on\ the\ canvas\n\n\ \ \ global\ candle\ len\ active\ stat\n\n\ \ \ \$w\ delete\ \"c\$nr\"\n\n\ \ \ set\ \ ww\ \[expr\ \{\ \$candle(sC)\ +\ \$candle(wC)\ \}\ \]\n\ \ \ set\ \ x1\ \[expr\ \{\ \$candle(sC)\ +\ (\$nr-1)\ *\ \$ww\ \}\ \]\n\n\ \ \ set\ \ x2\ \$x1\n\ \ \ incr\ x2\ \$candle(wC)\n\n\ \ \ set\ \ y1\ \[expr\ \{\ \$::maxY\ -\ 40\ \}\ \]\n\ \ \ set\ \ ll\ \[expr\ \{\ \$len(\$nr)\ *\ \$candle(bC)\ +\ \$candle(hC)\ \}\ \]\n\ \ \ set\ \ y2\ \[expr\ \{\ \$y1\ -\ \$ll\ \}\ \]\n\n#\ Candle:\n\ \ \ .c1\ create\ rect\ \ \ \$x1\ \$y1\ \ \$x2\ \$y2\ \ -width\ 1\ -fill\ \$candle(cC)\ \ -tag\ \"c\$nr\ x\"\n\n#\ Holder:\n\ \ \ incr\ x1\ -5\n\ \ \ incr\ x2\ \ 5\n\ \ \ set\ \ y2\ \$y1\n\ \ \ incr\ y1\ 10\n\ \ \ .c1\ create\ rect\ \ \ \$x1\ \$y1\ \ \$x2\ \$y2\ \ -width\ 1\ -fill\ gold\ \ -tags\ \"c\$nr\ h\"\n\n#\ Wick:\n\ \ \ set\ \ c\ \ \ grey\n\ \ \ if\ \{\ \$len(\$nr)\ <\ \$::candle(iC)\ \}\ \{\ set\ c\ black\ \}\n\n\ \ \ set\ \ x1\ \[expr\ \{\ \$candle(sC)\ +\ (\$nr-1)\ *\ \$ww\ +\ 22\ \}\ \]\n\ \ \ set\ \ x2\ \$x1\n\ \ \ incr\ x2\ 3\n\n\ \ \ set\ ll\ \[expr\ \{\ \$len(\$nr)\ *\ \$candle(bC)\ +\ \$candle(hC)\ \}\ \]\n\ \ \ set\ \ y1\ \[expr\ \{\ \$::maxY\ -\ 40\ -\ \$ll\ \}\ \]\n\n\ \ \ set\ \ y2\ \$y1\n\ \ \ incr\ y2\ -15\n\n\ \ \ .c1\ create\ rect\ \ \ \$x1\ \$y1\ \ \$x2\ \$y2\ \ -width\ 1\ -fill\ \$c\ \ -tag\ \"c\$nr\ w\"\n\n#\ Flame/Smoke:\n\ \ \ if\ \$active(\$nr)\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ not\ selected:\ draw\ nothing\n\ \ \ \ \ if\ \{\ \$len(\$nr)\ <\ 1\ \}\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Candle\ burnt\ out:\ draw\ smoke\n\n\ \ \ \ \ \ \ incr\ x1\ -10\n\ \ \ \ \ \ \ incr\ x2\ \ 10\n\n\ \ \ \ \ \ \ incr\ y1\ \ -7\n\ \ \ \ \ \ \ incr\ y2\ -35\n\n\ \ \ \ \ \ \ set\ \ yM\ \$y1\n\ \ \ \ \ \ \ incr\ yM\ -18\n\n\ \ \ \ \ \ \ .c1\ create\ line\ \ \ \$x1\ \$y1\ \ \$x2\ \$yM\ \ \$x1\ \$yM\ \ \$x2\ \$y2\ \\\n\ \ \ \ \ \ \ \ \ \ \ -fill\ grey\ \ -width\ 8\ \\\n\ \ \ \ \ \ \ \ \ \ \ -capstyle\ round\ -joinstyle\ round\ \\\n\ \ \ \ \ \ \ \ \ \ \ -smooth\ bezier\ -splinesteps\ 4\ \\\n\ \ \ \ \ \ \ \ \ \ \ -tag\ \"c\$nr\ s\"\n\n\ \ \ \ \ \}\ else\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ inner\ flame\ blue,\ outer\ flame\ yellow\n\ \ \ \ \ #\ to\ query\ color\ in\ console:\ \ puts\ \[.c1\ itemcget\ \[.c1\ find\ withtag\ fb\]\ -fill\ \]\n\ \ \ \ \ \ \ incr\ x1\ \ -3\n\ \ \ \ \ \ \ incr\ x2\ \ \ 3\n\ \ \ \ \ \ \ incr\ y1\ \ -5\n\ \ \ \ \ \ \ incr\ y2\ -12\n\ \ \ \ \ \ \ .c1\ create\ oval\ \ \ \$x1\ \$y1\ \ \$x2\ \$y2\ \ -width\ 1\ \ -fill\ SteelBlue2\ \ -tag\ \"c\$nr\ fb\"\n\n\ \ \ \ \ \ \ incr\ x1\ \ -7\n\ \ \ \ \ \ \ incr\ x2\ \ \ 7\n\ \ \ \ \ \ \ incr\ y1\ \ \ 2\n\ \ \ \ \ \ \ incr\ y2\ -23\n\ \ \ \ \ \ \ .c1\ create\ oval\ \ \ \$x1\ \$y1\ \ \$x2\ \$y2\ \ -width\ 1\ \ -fill\ yellow\ \ -tag\ \"c\$nr\ fy\"\n\ \ \ \ \ \ \ .c1\ raise\ \"fb\"\n\ \ \ \ \ \}\n\ \ \ \}\n\ \}\n\n\n#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+\n\n\n\ proc\ Burn\ \{w\}\ \{\n\ #:\ Burn\ one\ slice\ of\ selected\ candles,\ update\ statistics.\n\n\ \ \ global\ candle\ len\ active\ stat\n\n\ \ \ set\ ok\ \ 1\n\ \ \ set\ adv\ 0\n\ \ \ for\ \{\ set\ i\ 1\ \}\ \{\ \$i\ <=\ \$candle(maxC)\ \}\ \{\ incr\ i\ 1\ \}\ \{\n\ \ \ \ \ if\ \ \$active(\$i)\ \{\n\ \ \ \ \ \ \ if\ \{\ \$::len(\$i)\ <\ 1\ \}\ \{\ set\ ok\ 0\;\ bell\;\ puts\ \"fail:\ \$i\"\;\ return\ \}\n\ \ \ \ \ \ \ incr\ adv\ 1\n\ \ \ \ \ \}\n\ \ \ \}\n\n\ \ \ if\ \{\$ok\ &&\ \$adv\}\ \{\n\ \ \ \ \ incr\ stat(a\$adv)\ 1\n\ \ \ \ \ puts\ -nonewline\ \"Advent\ \$adv\ -\ Candles:\"\n\n\ \ \ \ \ for\ \{\ set\ nr\ 1\ \}\ \{\ \$nr\ <=\ \$candle(maxC)\ \}\ \{\ incr\ nr\ 1\ \}\ \{\n\ \ \ \ \ \ \ if\ \ \$active(\$nr)\ \{\n\ \ \ \ \ \ \ \ \ incr\ len(\$nr)\ \ -1\n\ \ \ \ \ \ \ \ \ DrawCandle\ \$w\ \$nr\n\ \ \ \ \ \ \ \ \ incr\ stat(c\$nr)\ 1\n\ \ \ \ \ \ \ \ \ puts\ -nonewline\ \"\ \$nr\"\n\ \ \ \ \ \ \ \}\n\ \ \ \ \ \}\n\ \ \ \ \ puts\ \"\ \"\n\ \ \ \}\n\n\ \}\n\n\n#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+\n\n\n\ proc\ Click\ \{w\}\ \{\n\ #:\ When\ clicking\ on\ a\ candle,\ toggle\ the\ corresponding\ checkbutton\n\ \ \ set\ i\ 0\n\ \ \ set\ Tags\ \[\$w\ itemcget\ current\ -tag\ \]\n\ \ \ scan\ \$Tags\ \"%c%d%s\"\ x\ i\ y\n##\ puts\ \"\$Tags:\ \$i\"\n\ \ \ if\ \{\ \$i\ \}\ \{\ .cb\$i\ invoke\ \}\n\ \}\n\n\n\ proc\ CheckButtons\ \{w\}\ \{\n\ #:\ Check\ how\ many\ checkbuttons\ are\ active,\ update\ \"Burn\"-Button\ and\ candle/flame\n\n\ \ \ global\ candle\ len\ active\ stat\n\n\ \ \ set\ adv\ 0\n\ \ \ for\ \{\ set\ i\ 1\ \}\ \{\ \$i\ <=\ \$candle(maxC)\ \}\ \{\ incr\ i\ 1\ \}\ \{\n\ \ \ \ \ if\ \ \$active(\$i)\ \{\ incr\ adv\ 1\ \}\n\ \ \ \ \ DrawCandle\ \$w\ \$i\n\ \ \ \}\n\n\ \ \ if\ \{\$adv\}\ \{\n\ \ \ \ \ .b1\ configure\ -text\ \"Advent\ \$adv\"\ -state\ active\n\ \ \ \}\ else\ \{\n\ \ \ \ \ .b1\ configure\ -text\ \"\ -\ -\ -\ -\ -\ \"\ -state\ disabled\n\ \ \ \}\n\ \}\n\n\n\ proc\ Init\ \{w\}\ \{\n\ #:\ Assign\ variables,\ draw\ all\ candles\n\n\ \ \ global\ candle\ len\ active\ stat\n\n\ \ \ \$w\ delete\ \"all\"\n\n\ \ \ puts\ \"#\ New:\ \$candle(iC)\"\n\ \ \ for\ \{\ set\ i\ 1\ \}\ \{\ \$i\ <=\ \$candle(maxC)\ \}\ \{\ incr\ i\ 1\ \}\ \{\n\ \ \ \ \ set\ len(\$i)\ \ \ \ \$candle(iC)\ \n\ \ \ \ \ set\ active(\$i)\ 0\n\ \ \ \ \ set\ stat(c\$i)\ \ 0\n\ \ \ \ \ set\ stat(a\$i)\ \ 0\n\ \ \ \ \ DrawCandle\ \$w\ \$i\n\ \ \ \}\n#\ \ set\ active(1)\ 1\n\ \ \ .cb1\ invoke\n\ \}\n\n\n#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+---\n\n\n#:\ Main\n\ wm\ title\ .\ \"\$Prg(Title)\ \$Prg(Version)\"\n\ puts\ \ \ \ \ \ \ \"\$Prg(Title)\ \$Prg(Version)\"\n\n\ if\ \{\[file\ exists\ \ advent.ico\]\}\ \{\n\ \ \ wm\ iconbitmap\ .\ advent.ico\n\ \}\n\n\ frame\ .f1\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ display\n\ frame\ .f2\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ buttons\n\ frame\ .f3\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ candle-stats\n\ frame\ .f4\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ advent-stats\n\ pack\ .f1\ .f2\ .f3\ .f4\n\n\ #\ Candle-attr.:\ totalnumber,\ color,\ init,\ height0,width,\ spacing,\ burn-amount\n\ array\ set\ candle\ \{\ maxC\ 4\ \ cC\ red2\ \ iC\ 10\ \ hC\ 2\ \ \ wC\ 50\ \ \ sC\ 50\ \ \ bC\ 10\ \ \ \}\n\n#set\ maxX\ 450\n\ set\ maxX\ \[expr\ \{\ \$candle(maxC)\ *\ (\$candle(wC)\ +\ \$candle(sC))\ +\ 50\ \}\ \]\n#set\ maxY\ \[expr\ \{\ \$candle(hC)\ +\ \$candle(iC)\ *\ \$candle(bC)\ +\ 100\ \}\ \]\n\ set\ maxY\ 305\ \ \ \ \ \ \ \ \;#\ room\ for\ candles\ of\ length\ 20\n\n\ for\ \{\ set\ i\ 1\ \}\ \{\ \$i\ <=\ \$candle(maxC)\ \}\ \{\ incr\ i\ 1\ \}\ \{\n\ \ \ checkbutton\ .cb\$i\ \ -variable\ active(\$i)\ -text\ \$i\ -command\ \{\ CheckButtons\ .c1\ \}\n\ \ \ entry\ \ \ \ \ \ \ .ec\$i\ \ -textvar\ stat(c\$i)\ -width\ 5\ -state\ readonly\n\ \ \ entry\ \ \ \ \ \ \ .ea\$i\ \ -textvar\ stat(a\$i)\ -width\ 5\ -state\ readonly\n\n\ \ \ set\ k1\ \"Key-\$i\"\n\ \ \ set\ k2\ \"Key-KP_\$i\"\n\ \ \ set\ c\ \".cb\$i\"\n\ ##puts\ \"\$i:\ \$k1\ \$k2\ \$c\"\n\ \ \ bind\ all\ <\$k1>\ \[list\ \$c\ invoke\]\n\ \ \ bind\ all\ <\$k2>\ \[list\ \$c\ invoke\]\n\ \}\n\n\ canvas\ \ .c1\ -width\ \$maxX\ -height\ \$maxY\ \ -bg\ white\n\ pack\ \ \ \ .c1\ -in\ .f1\n\n\ tk_optionMenu\ .m1\ ::candle(iC)\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 9\ 10\ 11\ 12\ 13\ 14\ 15\ 16\ 17\ 18\ 19\ 20\ \n\ .m1\ configure\ -width\ 3\n\n\ button\ \ .bN\ -text\ \"New\"\ \ \ -command\ \{\ Init\ .c1\ \}\n\ button\ \ .b1\ -text\ \"Burn\"\ \ -command\ \{\ Burn\ .c1\ \}\ -width\ 8\n\ bind\ all\ <Return>\ \{\ Burn\ .c1\ \}\n\n##Todo:\ var.\ number\ of\ checkbuttons+displays\ /\ put\ on\ canvas\ at\ candle\n\ pack\ .m1\ .bN\ \ \ .cb1\ .cb2\ .cb3\ .cb4\ .b1\ \ -in\ .f2\ \ -side\ left\ -padx\ 2\n\n\ label\ \ \ .lab1\ -text\ \"Candle\ burnt:\"\ -width\ 21\n\ label\ \ \ .lab2\ -text\ \"Advent:\"\ \ \ \ \ \ \ -width\ 21\n\ label\ \ \ .lab0\ -text\ \"\ \"\ \ \ \ \ \ \ \ \ \ \ \ \ -width\ 16\n\ label\ \ \ .lab9\ -text\ \"\ \"\ \ \ \ \ \ \ \ \ \ \ \ \ -width\ 16\n\ pack\ .lab1\ .ec1\ .ec2\ .ec3\ .ec4\ .lab0\ \ -in\ .f3\ \ -side\ left\ -padx\ 2\n\ pack\ .lab2\ .ea1\ .ea2\ .ea3\ .ea4\ .lab9\ \ -in\ .f4\ \ -side\ left\ -padx\ 2\n\n#\ Debug:\n\ bind\ .\ \ <F2>\ \ \ \ \ \{\ console\ show\ \}\n\ bind\ .\ \ <Escape>\ \{\ source\ \$argv0\ \}\n\ if\ 0\ \{\n\ \ \ proc\ int\ x\ \ \{\ expr\ int(\$x)\ \}\n\ \ \ bind\ .c1\ <Motion>\ \{wm\ title\ .\ \"\[int\ \[%W\ canvasx\ %x\]\],\[int\ \[%W\ canvasy\ %y\]\]=\[.c1\ find\ withtag\ current\]\"\}\n\ \ \ set\ ::candle(iC)\ 3\n\ \}\n\n\ InitMenu\n\ Init\ .c1\ \n\ bind\ .c1\ <1>\ \ \ \ \ \ \{\ Click\ .c1\ \}\n\ focus\ -force\ .\n\n#catch\ \{console\ show\}\n#catch\ \{wm\ withdraw\ .\}\n\n#.\n----\nUpdated,\ mostly\ to\ allow\ to\ select\ the\ starting\ candle-length.\n\nClicking\ on\ a\ candle\ also\ toggles\ the\ corresponding\ checkbox.\nF2\ activates\ a\ console,\ that\ shows\ a\ log\ of\ all\ actions.\n\n'''HJG'''\ 2009-01-11\ -\ Now\ v2.0\ with\ proper\ menu,\ options\ for\ candle-colors,\ and\ hotkeys.\ \nI.e.\ 1,2,3,4\ and\ enter-key\ can\ be\ used\ to\ select\ candles\ and\ burn\ one\ slice\ of\ them.\n\n\nNext\ project:\ \[Advent\ calendar\]\n\n<<categories>>\ Graphics\ |\ Toys regexp2} CALL {my render {Advent Wreath} \[HJG\]\ 2008-12\ This\ program\ simulates\ the\ candles\ burning\ down\ on\ an\ advent-wreath,\ \nand\ keeps\ track\ of\ statistics,\ such\ as\ how\ many\ times\ each\ candle\ was\ lit,\nand\ how\ many\ times\ each\ advent\ was\ celebrated.\nEvery\ time\ 'burn'\ is\ selected,\ the\ candles\ are\ burned\ for\ certain\ time,\ e.g.\ one\ hour.\n\nSo\ you\ can\ try\ to\ maximize\ the\ usage\ you\ might\ get\ out\ of\ a\ set\ of\ candles...\n\n======\n#!/bin/sh\n#\ Restart\ with\ tcl:\ -*-\ mode:\ tcl\;\ tab-width:\ 4\;\ -*-\ \\\n\ exec\ wish\ \$0\ \$\{1+\"\$@\"\}\n\n#\ http://wiki.tcl.tk/20479\ -\ advent20.tcl\ -\ 2009-01-10\n#\ Simulate\ an\ advent-wreath:\ select\ which\ candles\ to\ light,\ press\ button\ to\ burn\n\n#\ 1.1\ \ 2008-12-21:\ log\ to\ console\n#\ 1.2\ \ 2008-12-22:\ wick\n#\ 1.3\ \ 2008-12-23:\ bind,\ Click,\ tk_optionMenu\ for\ initial\ length\ of\ candles\n#\ 1.4\ \ 2008-12-24:\ Click,\ CountButtons,\ CheckButtons\ :\ \n#\ \ \ \ click\ on\ candle\ to\ toggle\ checkbox\ +\ update\ text\ on\ \"Burn\"-button\ \n#\ 1.5\ \ 2008-12-25:\ len\ ->\ burncount,\ Flame/Smoke\n#\ 1.6\ \ 2008-12-26:\ code\ cleanup\n#\ 1.7\ \ 2008-12-27:\ smoke,\ inner+outer\ flame\ \n#\ 1.9\ \ 2009-01-09:\ Menu,\ Options/candle-colors\n#\ 2.0\ \ 2009-01-10:\ Hotkeys\ for\ checkbuttons\n\n\n#\ Todo:\ \n#\ *\ variable\ number\ of\ candles/checkbuttons/stats-displays\n#\ *\ allow\ initial\ state\ with\ candles\ of\ different\ length\n#\ *\ load/save\ -\ F3\n#\ *\ delete+redraw\ -->\ itemconfig\n#\ *\ show\ stats\ on\ candle/holder:\ current\ len,\ burn-count\n#\ *\ disable\ checkboxes\ of\ burnt-out\ candles\n#\ *\ use\ grid\ for\ positioning\ the\ candles\n#\ *\ candleflames\ +\ animation\n\n#\ *\ icon\ in\ program\ itself:\ include\ data\ for\ iconbitmap\n#\ *\ selfrunning\ Demo\n#\ ...\n\n\n\ package\ require\ Tk\n\n\ global\ Prg\n\n\ set\ Prg(Title)\ \ \ \ \"Advent-Wreath\"\n\ set\ Prg(Version)\ \ \"v2.0\"\n\ set\ Prg(Date)\ \ \ \ \ \"2009-01-10\"\n\ set\ Prg(Author)\ \ \ \"Hans-Joachim\ Gurt\"\n\ set\ Prg(Contact)\ \ \[string\ map\ -nocase\ \{:\ @\ !\ .\}\ gurt:gmx!de\]\n\ set\ Prg(About)\ \ \ \ \"Simulates\ the\ candles\ on\ an\ advent-wreath:\\nselect\ which\ candles\ to\ light,\ press\ button\ to\ burn\ one\ slice.\"\n\n\ proc\ ClrCanvas\ \{w\}\ \{\n\ \ \ \$w\ delete\ \"all\"\n\ \}\n\n\ proc\ decr\ \{x\ y\}\ \{\ expr\ \$x\ -\ \$y\ \}\n\n\n#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+\n\n\n\ proc\ About\ \{\}\ \{\n\ #:\ Short\ info\ about\ the\ program\n\ \ \ global\ Prg\n\ \ \ set\ txt\ \ \ \ \"\$Prg(Title)\ \$Prg(Version)\ -\ \"\n\ \ \ append\ txt\ \"\$Prg(Date)\\nby\ \$Prg(Author)\ -\ \$Prg(Contact)\\n\\n\$Prg(About)\"\n\ \ \ tk_messageBox\ -icon\ info\ -message\ \$txt\ -title\ \"About\ \$Prg(Title)\ \$Prg(Version)\"\n\ \}\n\n\n\ proc\ InitMenu\ \{\}\ \{\n\ #:\ Install\ menu\n\ \ \ option\ add\ *Menu.tearOff\ 0\n\n\ \ \ .\ config\ -menu\ \[menu\ .menu\]\n\n\ \ \ menu\ .menu.game\n\ \ \ .menu\ add\ cascade\ -label\ \"File\"\ -underline\ 0\ -menu\ .menu.game\n\n\ \ \ .menu.game\ add\ command\ -label\ \"New\"\ -command\ \{\ Init\ .c1\ \}\ -underline\ 0\ \\\n\ \ \ \ \ \ \ -accelerator\ \"F5\"\n\ \ \ .menu.game\ add\ command\ -label\ \"Burn\"\ -command\ \{\ Burn\ .c1\ \}\ -underline\ 0\ \\\n\ \ \ \ \ \ \ -accelerator\ \"F6\"\n\ \ \ .menu.game\ add\ separator\n\ \ \ .menu.game\ add\ command\ -label\ \"Exit\"\ -underline\ 1\ -command\ exit\ \\\n\ \ \ \ \ \ \ -accelerator\ \"F4\"\n\n\ \ \ menu\ .menu.opt\n\ \ \ .menu\ add\ cascade\ -label\ \"Options\"\ -underline\ 0\ -menu\ .menu.opt\n\n\ \ \ .menu.opt\ add\ cascade\ -label\ \"Color\"\ -menu\ .menu.opt.col\ -underline\ 0\n\n\ \ \ menu\ .menu.opt.col\n\ \ \ foreach\ \{cn\ cv\}\ \[list\ \ Red\ red2\ \ Pink\ HotPink1\ \ Yellow\ Yellow1\ \ Beewax\ goldenrod\ \ Green\ green3\ \ Blue\ CadetBlue2\ \ White\ beige\ \]\ \{\n\ \ \ \ \ \ \ .menu.opt.col\ add\ radio\ -label\ \$cn\ \\\n\ \ \ \ \ \ \ \ \ \ \ -variable\ ::candle(cC)\ \\\n\ \ \ \ \ \ \ \ \ \ \ -value\ \$cv\ \\\n\ \ \ \ \ \ \ \ \ \ \ -underline\ 0\ \\\n\ \ \ \ \ \ \ \ \ \ \ -command\ \{\ Init\ .c1\ \}\n\ \ \ \}\n\n\ \ \ .menu.opt\ add\ cascade\ -label\ \"Length\"\ -menu\ .menu.opt.len\ -underline\ 0\n\ \ \ menu\ .menu.opt.len\n\ \ \ for\ \{\ set\ i\ 2\ \}\ \{\ \$i\ <=\ 20\ \}\ \{\ incr\ i\ 1\ \}\ \{\n\ \ \ \ \ \ \ .menu.opt.len\ add\ radio\ -label\ \"\$i\"\ \\\n\ \ \ \ \ \ \ \ \ \ \ -variable\ ::candle(iC)\ \ -value\ \$i\ \\\n\ \ \ \ \ \ \ \ \ \ \ -command\ \{\ Init\ .c1\ \}\n\ \ \ \}\n\n\ \ \ menu\ .menu.help\n\ \ \ .menu\ add\ cascade\ -label\ \"Help\"\ -underline\ 0\ -menu\ .menu.help\n\ \ \ .menu.help\ add\ command\ -label\ \"About\"\ -underline\ 0\ -command\ About\\\n\ \ \ \ \ \ \ -accelerator\ \"F1\"\n\ \ \ .menu.help\ add\ separator\n\ \ \ .menu.help\ add\ command\ -label\ \"Console\"\ -underline\ 0\ -command\ \{\ console\ show\ \}\ \\\n\ \ \ \ \ \ \ -accelerator\ \"F2\"\n\n\ \ \ bind\ all\ <Key-F1>\ About\n\ \ \ bind\ all\ <Key-F4>\ exit\n\ \ \ bind\ all\ <Key-F5>\ \{\ Init\ .c1\ \}\n\ \ \ bind\ all\ <Key-F6>\ \{\ Burn\ .c1\ \}\n\ \}\n\n\n#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+\n\n\n\ proc\ DrawCandle\ \{w\ nr\}\ \{\n\ #:\ Draw\ one\ of\ the\ candles\ /\ calculate\ its\ position\ on\ the\ canvas\n\n\ \ \ global\ candle\ len\ active\ stat\n\n\ \ \ \$w\ delete\ \"c\$nr\"\n\n\ \ \ set\ \ ww\ \[expr\ \{\ \$candle(sC)\ +\ \$candle(wC)\ \}\ \]\n\ \ \ set\ \ x1\ \[expr\ \{\ \$candle(sC)\ +\ (\$nr-1)\ *\ \$ww\ \}\ \]\n\n\ \ \ set\ \ x2\ \$x1\n\ \ \ incr\ x2\ \$candle(wC)\n\n\ \ \ set\ \ y1\ \[expr\ \{\ \$::maxY\ -\ 40\ \}\ \]\n\ \ \ set\ \ ll\ \[expr\ \{\ \$len(\$nr)\ *\ \$candle(bC)\ +\ \$candle(hC)\ \}\ \]\n\ \ \ set\ \ y2\ \[expr\ \{\ \$y1\ -\ \$ll\ \}\ \]\n\n#\ Candle:\n\ \ \ .c1\ create\ rect\ \ \ \$x1\ \$y1\ \ \$x2\ \$y2\ \ -width\ 1\ -fill\ \$candle(cC)\ \ -tag\ \"c\$nr\ x\"\n\n#\ Holder:\n\ \ \ incr\ x1\ -5\n\ \ \ incr\ x2\ \ 5\n\ \ \ set\ \ y2\ \$y1\n\ \ \ incr\ y1\ 10\n\ \ \ .c1\ create\ rect\ \ \ \$x1\ \$y1\ \ \$x2\ \$y2\ \ -width\ 1\ -fill\ gold\ \ -tags\ \"c\$nr\ h\"\n\n#\ Wick:\n\ \ \ set\ \ c\ \ \ grey\n\ \ \ if\ \{\ \$len(\$nr)\ <\ \$::candle(iC)\ \}\ \{\ set\ c\ black\ \}\n\n\ \ \ set\ \ x1\ \[expr\ \{\ \$candle(sC)\ +\ (\$nr-1)\ *\ \$ww\ +\ 22\ \}\ \]\n\ \ \ set\ \ x2\ \$x1\n\ \ \ incr\ x2\ 3\n\n\ \ \ set\ ll\ \[expr\ \{\ \$len(\$nr)\ *\ \$candle(bC)\ +\ \$candle(hC)\ \}\ \]\n\ \ \ set\ \ y1\ \[expr\ \{\ \$::maxY\ -\ 40\ -\ \$ll\ \}\ \]\n\n\ \ \ set\ \ y2\ \$y1\n\ \ \ incr\ y2\ -15\n\n\ \ \ .c1\ create\ rect\ \ \ \$x1\ \$y1\ \ \$x2\ \$y2\ \ -width\ 1\ -fill\ \$c\ \ -tag\ \"c\$nr\ w\"\n\n#\ Flame/Smoke:\n\ \ \ if\ \$active(\$nr)\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ not\ selected:\ draw\ nothing\n\ \ \ \ \ if\ \{\ \$len(\$nr)\ <\ 1\ \}\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ Candle\ burnt\ out:\ draw\ smoke\n\n\ \ \ \ \ \ \ incr\ x1\ -10\n\ \ \ \ \ \ \ incr\ x2\ \ 10\n\n\ \ \ \ \ \ \ incr\ y1\ \ -7\n\ \ \ \ \ \ \ incr\ y2\ -35\n\n\ \ \ \ \ \ \ set\ \ yM\ \$y1\n\ \ \ \ \ \ \ incr\ yM\ -18\n\n\ \ \ \ \ \ \ .c1\ create\ line\ \ \ \$x1\ \$y1\ \ \$x2\ \$yM\ \ \$x1\ \$yM\ \ \$x2\ \$y2\ \\\n\ \ \ \ \ \ \ \ \ \ \ -fill\ grey\ \ -width\ 8\ \\\n\ \ \ \ \ \ \ \ \ \ \ -capstyle\ round\ -joinstyle\ round\ \\\n\ \ \ \ \ \ \ \ \ \ \ -smooth\ bezier\ -splinesteps\ 4\ \\\n\ \ \ \ \ \ \ \ \ \ \ -tag\ \"c\$nr\ s\"\n\n\ \ \ \ \ \}\ else\ \{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ inner\ flame\ blue,\ outer\ flame\ yellow\n\ \ \ \ \ #\ to\ query\ color\ in\ console:\ \ puts\ \[.c1\ itemcget\ \[.c1\ find\ withtag\ fb\]\ -fill\ \]\n\ \ \ \ \ \ \ incr\ x1\ \ -3\n\ \ \ \ \ \ \ incr\ x2\ \ \ 3\n\ \ \ \ \ \ \ incr\ y1\ \ -5\n\ \ \ \ \ \ \ incr\ y2\ -12\n\ \ \ \ \ \ \ .c1\ create\ oval\ \ \ \$x1\ \$y1\ \ \$x2\ \$y2\ \ -width\ 1\ \ -fill\ SteelBlue2\ \ -tag\ \"c\$nr\ fb\"\n\n\ \ \ \ \ \ \ incr\ x1\ \ -7\n\ \ \ \ \ \ \ incr\ x2\ \ \ 7\n\ \ \ \ \ \ \ incr\ y1\ \ \ 2\n\ \ \ \ \ \ \ incr\ y2\ -23\n\ \ \ \ \ \ \ .c1\ create\ oval\ \ \ \$x1\ \$y1\ \ \$x2\ \$y2\ \ -width\ 1\ \ -fill\ yellow\ \ -tag\ \"c\$nr\ fy\"\n\ \ \ \ \ \ \ .c1\ raise\ \"fb\"\n\ \ \ \ \ \}\n\ \ \ \}\n\ \}\n\n\n#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+\n\n\n\ proc\ Burn\ \{w\}\ \{\n\ #:\ Burn\ one\ slice\ of\ selected\ candles,\ update\ statistics.\n\n\ \ \ global\ candle\ len\ active\ stat\n\n\ \ \ set\ ok\ \ 1\n\ \ \ set\ adv\ 0\n\ \ \ for\ \{\ set\ i\ 1\ \}\ \{\ \$i\ <=\ \$candle(maxC)\ \}\ \{\ incr\ i\ 1\ \}\ \{\n\ \ \ \ \ if\ \ \$active(\$i)\ \{\n\ \ \ \ \ \ \ if\ \{\ \$::len(\$i)\ <\ 1\ \}\ \{\ set\ ok\ 0\;\ bell\;\ puts\ \"fail:\ \$i\"\;\ return\ \}\n\ \ \ \ \ \ \ incr\ adv\ 1\n\ \ \ \ \ \}\n\ \ \ \}\n\n\ \ \ if\ \{\$ok\ &&\ \$adv\}\ \{\n\ \ \ \ \ incr\ stat(a\$adv)\ 1\n\ \ \ \ \ puts\ -nonewline\ \"Advent\ \$adv\ -\ Candles:\"\n\n\ \ \ \ \ for\ \{\ set\ nr\ 1\ \}\ \{\ \$nr\ <=\ \$candle(maxC)\ \}\ \{\ incr\ nr\ 1\ \}\ \{\n\ \ \ \ \ \ \ if\ \ \$active(\$nr)\ \{\n\ \ \ \ \ \ \ \ \ incr\ len(\$nr)\ \ -1\n\ \ \ \ \ \ \ \ \ DrawCandle\ \$w\ \$nr\n\ \ \ \ \ \ \ \ \ incr\ stat(c\$nr)\ 1\n\ \ \ \ \ \ \ \ \ puts\ -nonewline\ \"\ \$nr\"\n\ \ \ \ \ \ \ \}\n\ \ \ \ \ \}\n\ \ \ \ \ puts\ \"\ \"\n\ \ \ \}\n\n\ \}\n\n\n#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+\n\n\n\ proc\ Click\ \{w\}\ \{\n\ #:\ When\ clicking\ on\ a\ candle,\ toggle\ the\ corresponding\ checkbutton\n\ \ \ set\ i\ 0\n\ \ \ set\ Tags\ \[\$w\ itemcget\ current\ -tag\ \]\n\ \ \ scan\ \$Tags\ \"%c%d%s\"\ x\ i\ y\n##\ puts\ \"\$Tags:\ \$i\"\n\ \ \ if\ \{\ \$i\ \}\ \{\ .cb\$i\ invoke\ \}\n\ \}\n\n\n\ proc\ CheckButtons\ \{w\}\ \{\n\ #:\ Check\ how\ many\ checkbuttons\ are\ active,\ update\ \"Burn\"-Button\ and\ candle/flame\n\n\ \ \ global\ candle\ len\ active\ stat\n\n\ \ \ set\ adv\ 0\n\ \ \ for\ \{\ set\ i\ 1\ \}\ \{\ \$i\ <=\ \$candle(maxC)\ \}\ \{\ incr\ i\ 1\ \}\ \{\n\ \ \ \ \ if\ \ \$active(\$i)\ \{\ incr\ adv\ 1\ \}\n\ \ \ \ \ DrawCandle\ \$w\ \$i\n\ \ \ \}\n\n\ \ \ if\ \{\$adv\}\ \{\n\ \ \ \ \ .b1\ configure\ -text\ \"Advent\ \$adv\"\ -state\ active\n\ \ \ \}\ else\ \{\n\ \ \ \ \ .b1\ configure\ -text\ \"\ -\ -\ -\ -\ -\ \"\ -state\ disabled\n\ \ \ \}\n\ \}\n\n\n\ proc\ Init\ \{w\}\ \{\n\ #:\ Assign\ variables,\ draw\ all\ candles\n\n\ \ \ global\ candle\ len\ active\ stat\n\n\ \ \ \$w\ delete\ \"all\"\n\n\ \ \ puts\ \"#\ New:\ \$candle(iC)\"\n\ \ \ for\ \{\ set\ i\ 1\ \}\ \{\ \$i\ <=\ \$candle(maxC)\ \}\ \{\ incr\ i\ 1\ \}\ \{\n\ \ \ \ \ set\ len(\$i)\ \ \ \ \$candle(iC)\ \n\ \ \ \ \ set\ active(\$i)\ 0\n\ \ \ \ \ set\ stat(c\$i)\ \ 0\n\ \ \ \ \ set\ stat(a\$i)\ \ 0\n\ \ \ \ \ DrawCandle\ \$w\ \$i\n\ \ \ \}\n#\ \ set\ active(1)\ 1\n\ \ \ .cb1\ invoke\n\ \}\n\n\n#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+---\n\n\n#:\ Main\n\ wm\ title\ .\ \"\$Prg(Title)\ \$Prg(Version)\"\n\ puts\ \ \ \ \ \ \ \"\$Prg(Title)\ \$Prg(Version)\"\n\n\ if\ \{\[file\ exists\ \ advent.ico\]\}\ \{\n\ \ \ wm\ iconbitmap\ .\ advent.ico\n\ \}\n\n\ frame\ .f1\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ display\n\ frame\ .f2\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ buttons\n\ frame\ .f3\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ candle-stats\n\ frame\ .f4\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \;#\ advent-stats\n\ pack\ .f1\ .f2\ .f3\ .f4\n\n\ #\ Candle-attr.:\ totalnumber,\ color,\ init,\ height0,width,\ spacing,\ burn-amount\n\ array\ set\ candle\ \{\ maxC\ 4\ \ cC\ red2\ \ iC\ 10\ \ hC\ 2\ \ \ wC\ 50\ \ \ sC\ 50\ \ \ bC\ 10\ \ \ \}\n\n#set\ maxX\ 450\n\ set\ maxX\ \[expr\ \{\ \$candle(maxC)\ *\ (\$candle(wC)\ +\ \$candle(sC))\ +\ 50\ \}\ \]\n#set\ maxY\ \[expr\ \{\ \$candle(hC)\ +\ \$candle(iC)\ *\ \$candle(bC)\ +\ 100\ \}\ \]\n\ set\ maxY\ 305\ \ \ \ \ \ \ \ \;#\ room\ for\ candles\ of\ length\ 20\n\n\ for\ \{\ set\ i\ 1\ \}\ \{\ \$i\ <=\ \$candle(maxC)\ \}\ \{\ incr\ i\ 1\ \}\ \{\n\ \ \ checkbutton\ .cb\$i\ \ -variable\ active(\$i)\ -text\ \$i\ -command\ \{\ CheckButtons\ .c1\ \}\n\ \ \ entry\ \ \ \ \ \ \ .ec\$i\ \ -textvar\ stat(c\$i)\ -width\ 5\ -state\ readonly\n\ \ \ entry\ \ \ \ \ \ \ .ea\$i\ \ -textvar\ stat(a\$i)\ -width\ 5\ -state\ readonly\n\n\ \ \ set\ k1\ \"Key-\$i\"\n\ \ \ set\ k2\ \"Key-KP_\$i\"\n\ \ \ set\ c\ \".cb\$i\"\n\ ##puts\ \"\$i:\ \$k1\ \$k2\ \$c\"\n\ \ \ bind\ all\ <\$k1>\ \[list\ \$c\ invoke\]\n\ \ \ bind\ all\ <\$k2>\ \[list\ \$c\ invoke\]\n\ \}\n\n\ canvas\ \ .c1\ -width\ \$maxX\ -height\ \$maxY\ \ -bg\ white\n\ pack\ \ \ \ .c1\ -in\ .f1\n\n\ tk_optionMenu\ .m1\ ::candle(iC)\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 9\ 10\ 11\ 12\ 13\ 14\ 15\ 16\ 17\ 18\ 19\ 20\ \n\ .m1\ configure\ -width\ 3\n\n\ button\ \ .bN\ -text\ \"New\"\ \ \ -command\ \{\ Init\ .c1\ \}\n\ button\ \ .b1\ -text\ \"Burn\"\ \ -command\ \{\ Burn\ .c1\ \}\ -width\ 8\n\ bind\ all\ <Return>\ \{\ Burn\ .c1\ \}\n\n##Todo:\ var.\ number\ of\ checkbuttons+displays\ /\ put\ on\ canvas\ at\ candle\n\ pack\ .m1\ .bN\ \ \ .cb1\ .cb2\ .cb3\ .cb4\ .b1\ \ -in\ .f2\ \ -side\ left\ -padx\ 2\n\n\ label\ \ \ .lab1\ -text\ \"Candle\ burnt:\"\ -width\ 21\n\ label\ \ \ .lab2\ -text\ \"Advent:\"\ \ \ \ \ \ \ -width\ 21\n\ label\ \ \ .lab0\ -text\ \"\ \"\ \ \ \ \ \ \ \ \ \ \ \ \ -width\ 16\n\ label\ \ \ .lab9\ -text\ \"\ \"\ \ \ \ \ \ \ \ \ \ \ \ \ -width\ 16\n\ pack\ .lab1\ .ec1\ .ec2\ .ec3\ .ec4\ .lab0\ \ -in\ .f3\ \ -side\ left\ -padx\ 2\n\ pack\ .lab2\ .ea1\ .ea2\ .ea3\ .ea4\ .lab9\ \ -in\ .f4\ \ -side\ left\ -padx\ 2\n\n#\ Debug:\n\ bind\ .\ \ <F2>\ \ \ \ \ \{\ console\ show\ \}\n\ bind\ .\ \ <Escape>\ \{\ source\ \$argv0\ \}\n\ if\ 0\ \{\n\ \ \ proc\ int\ x\ \ \{\ expr\ int(\$x)\ \}\n\ \ \ bind\ .c1\ <Motion>\ \{wm\ title\ .\ \"\[int\ \[%W\ canvasx\ %x\]\],\[int\ \[%W\ canvasy\ %y\]\]=\[.c1\ find\ withtag\ current\]\"\}\n\ \ \ set\ ::candle(iC)\ 3\n\ \}\n\n\ InitMenu\n\ Init\ .c1\ \n\ bind\ .c1\ <1>\ \ \ \ \ \ \{\ Click\ .c1\ \}\n\ focus\ -force\ .\n\n#catch\ \{console\ show\}\n#catch\ \{wm\ withdraw\ .\}\n\n#.\n----\nUpdated,\ mostly\ to\ allow\ to\ select\ the\ starting\ candle-length.\n\nClicking\ on\ a\ candle\ also\ toggles\ the\ corresponding\ checkbox.\nF2\ activates\ a\ console,\ that\ shows\ a\ log\ of\ all\ actions.\n\n'''HJG'''\ 2009-01-11\ -\ Now\ v2.0\ with\ proper\ menu,\ options\ for\ candle-colors,\ and\ hotkeys.\ \nI.e.\ 1,2,3,4\ and\ enter-key\ can\ be\ used\ to\ select\ candles\ and\ burn\ one\ slice\ of\ them.\n\n\nNext\ project:\ \[Advent\ calendar\]\n\n<<categories>>\ Graphics\ |\ Toys} CALL {my revision {Advent Wreath}} CALL {::oo::Obj5438710 process revision/Advent+Wreath} CALL {::oo::Obj5438708 process}

-errorcode

NONE

-errorinfo

Unknow state transition: LINE -> END
    while executing
"error $msg"
    (class "::Wiki" method "render_wikit" line 6)
    invoked from within
"my render_$default_markup $N $C $mkup_rendering_engine"
    (class "::Wiki" method "render" line 8)
    invoked from within
"my render $name $C"
    (class "::Wiki" method "revision" line 31)
    invoked from within
"my revision $page"
    (class "::Wiki" method "process" line 56)
    invoked from within
"$server process [string trim $uri /]"

-errorline

4