# copyright (C) 1997-2006 Jean-Luc Fontaine (mailto:jfontain@free.fr)
# this program is free software: please read the COPYRIGHT file enclosed in this package or use the Help Copyright menu

# $Id: gui.tcl,v 2.159 2006/11/05 19:44:56 jfontain Exp $


# override Tk file dialog box icons:
set ::tk::Priv(updirImage) [image create photo -data {
    R0lGODlhFgAWAOcAANXW2MfN2LfC1rG91rG91bbB1sbM17O/13ua1FuF0kh40UF01Ud3z1qDznmY0LC91NfX18LJ13iY1D1z1z934FaL722e95Sy6p2353ql
    81qP8Ud62ztv01+GzrK90sTL2GGJ1DJv4GKR6azG9tnj9e/z+vL1+/H1++Do977Q8nWe6jhx2Ux6zai2zz9334as79Le9eTr+OXs+avC69rk9qC77Eh72Up4
    zLO90djY2HWW0zJv3oOp79Hd9Nfi9vv8/v////39/tfi9dXg9Zu37Dxz2G6PzdPT07O/1j1y1WGQ57vO8MjX8snX8vj5/cPT8XSd6D5y0qe1ztXV1XuZ0UB3
    3JOz7bjM7rnM7/f5/brM77bK7pu25Ud62XCRy8zO0cfN11uEz02F7KO76arB6/b4/F6U91CL+Dl68VN9zLnAzUh3z2GS7Zq15/r7/f7+/vf5/j2B/zl+/ENz
    zaezyWuX6Iqq5Yyr5fH0++3x+qnA66fB8czc+l+X/zp//T1x06Ctxl2P7XOb53ad57XJ8fP2/Xmk82CU84Ww/0uK/8TY/7vT/0eI/zt//Z+sxUaE9lKM9VKL
    9VGL9kSF/EOE/EuK/jyB/z2C/zx//EJyzKOvxTd69EOF/UKF/0CE/0KE/zZ59VB7y7K5xzhz4UiI/EmI/EKE/kqJ/0GE/UaG/GyMyMPFyT9z002F616S8V+S
    8V2R8WeX8pm69j1w0Zuqxc7OznSV0EB11m2Y53Sc6Huh6e7z/Pb5/Z2672aIycXFxb3G1F2Fzk9+1nyg4oKl5pm26sDR8q3E7oKm5lZ+yqiyw8/Pz77F012E
    zUp60nOZ4Yys542t6FZ+yauzw8vLy7rD0m+QzUZ2z1iE13qc246t5ZGv6ER1z0R0y0t4zURzy///////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////////yH5BAEKAP8ALAAAAAAWABYAAAj+AP8JHPgPQAAB
    AwgUMACAoEOCBxAkULBgAYMGDh5AeDgwgoQJFCpYuIAhg4YNHDp42OjwA4gQIkaQKGHCxAkUKVSsYNGCpcAIIFy8gBFDhowZSI3SqGHjBo4cA3Xs4NHDh9UZ
    P4AEmeFDyBAiRYwcgYokiZIlTJowmeEEiFsgM5gweQIlipQpAKhUsXIFC5YZWd66/TFDyxYuXbx8ARNGzBgyZGaUESx4hpkzaNKoEbCGTZs2M0y4dfP2xxsg
    cGbEkTOHDoEFdezcweM2j563e/i87ePnD6DXgQQNIgSkkKFDbxElUgRkEaNGfxwVYPAIUqRIkiZRqpTckndLlzDFZdJkoMEmTug5deqUqLt3T59AhRIFwMEo
    UqXylzJ1KjmqVKmQQsooqqzyzwOstOLKKwzCEstbsiz4iiutzEJLLf9AYMstuOQCRS656LILELz0AsWHuNziyy9HCARMMMIMQ8yMxBRjzDHIIEPMMMIko8wy
    UP2TAzPNOPMMNNEkqSQ0zzgjzTTU+JRhNdZcg0022myzjTbZYMONL8pQM8VDORwhhRdpdOONN9+EogotvywjJUE5TPGFGnQA4ogmoqxSy1gEBQQAOw==
}]
set ::tk::Priv(folderImage) [image create photo -data {
    R0lGODlhEAAQAMYAADJ02zJz2zNz2zJ03DFw1vX7/fX5/TBt0uj1/ej2/en1/V99sTFt0TBu0TFu0jBt0TBqzNvw/dru/dvu/drw/S9mxsvo/cvp/SVf0S5j
    wLni/bzi/bnh/bzh/Z7G7vz8/azR/S1hvana/anb/Ya57Iy9/Ym+/Ym9/SxeuJnT/SJZy2uq/Wup/SJZzCtasYjL/R9SxVCY/U+Y/U+X/R5SxSpYrnrE/RxJ
    vTmH/TmI/RtJvSlVqG2+/RhAtSh8/Sh7/Sd7/Rg/tShSo2K3/RM3qv39/a6uxhM3rChQnxAtoidNm0+u/QslmQwlmSdLlwkdkQkekQkekP//////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////yH5BAEKAH8ALAAAAAAQABAAAAe5gH9/AAECAwAAgoqLBAUGjgYGBIuKBwiXCQgKCAsMDQ4N
    Dwx/EBGmphIRExOpExEUEBUWs7QWFxi4uRgZGhobvhwdGB4fxR8gGCEiI7oYJB8lJiYnJxgoKSorxsUsKyzfLC0uLzAxMjIz5ucy5jM0NTY3ODk58zjz9PM6
    Ozw9Pj4/AP74AYTgwCBChhApwrChwyJGjiAZkuShRSNJlCxhYqSjx48dm/xx8qQklCgnn0RBCeUJpZcvAwEAOw==
}]
set ::tk::Priv(fileImage) [image create photo -data {
    R0lGODlhEAAQAIQAAI+Pj/////7+/vz8/Pv7+/n5+ff39/b29vr6+vj4+PT09PPz8/Ly8v39/fX19fHx8e/v7/Dw8Onp6evr6+jo6Ozs7Orq6u3t7e7u7qio
    qP///////////////////////yH5BAEKAB8ALAAAAAAQABAAAAWDICCOZCkGaBoIA1EYR3CqAoEkhrIwMqAGDcTLoWA8erRBIXFw7CBIFIuAIzIikijQBtM9
    JpRo7WZwPiqWCbLRKjQZkEvlckFGGLtHBIOB+KEnEYKDEQ9nFlknC4uMCwoTGZEZJw6Vlg4HFRkoAB8+BqChBgkXm52ePyoEkx+tJiatrSEAOw==
}]

set toolBarImage(new) [image create photo -data {
    R0lGODlhFgAWAKUAAM3R3c/T3snO2sTI1cHF07K3yP////3+/vX3+vHz+O3v9t/i6/j5+/P1+fDx+Obo8Ofp8fv8/ff4+/Dy+Nzf6fb4+vn6/IyRo/r7/O7w
    9+vt9M/S3snN2sjM2XR4hczQ3MrP2/z8/dve6NXZ49TX49PW4uXn8ODj7Nnc5tba5PHy+Ort8+Pm7uHk7ejq8vX2+vL0+ers89LW4P//////////////////
    /////////////////////////////////yH5BAEKAD8ALAAAAAAWABYAAAbpwB8gQCwKBoRC4cdsOgOGaPSASCgCi6XzKZ0yGo7AA6Ld/qBdQ0TSCEwilDI3
    HfkGGIYK2YzuRiwIF4KDF1t9UgcYEhkZGhscHR6GaQYHawkaCwAfIJJzXSEYCBALIiMkJZ5Nh5UMVSYnIigoKapMrAcqGisQJiwnCxS2Z11UGQoaEBAPLS0L
    w1AH0ggNExPILr0sLdB5FRUILw0JKsi8JibdEusICDDkyDHLLOrrFeIJVti99RL34/o0ZEs3aZ0/fAEH9gMHUAEyZQS5tAsHsNyued0iaLRggWGCCY14DZPh
    oaTJkyhtBQEAOw==
}]
set toolBarImage(open) [image create photo -data {
    R0lGODlhFgAWAOcAAAImtjJu2m6i7qamyqLG+tLS1hY+unJ6xs7y/jp+9tbi+rrq/g5S0tby/oq+/kJWvmp+xhpa0rLm/u7y+sbK1k6a/nqy8iIyyoqSzq6y
    0naK0gI6xmJ2yjZawkaG5vLy+h5Czp6m2vb2/pau5h5e1rKy0jZOyprO/m6S4lKO6laS+kZy0urq+qbe/gYqvrK20gY+3tLW6kaO/n6y/iJi7h5KwhI6tnai
    7lJmwgIqwrq61rLK9mKa6vL+/oaWzo6W0jJ29hYuwsLK7iZKwjJi0ipWyoa69laK4mqCyi5i0sLu/qK66maO7t7i9l6W6hpS5m6e7h5a7gIy1qLK/ub2/s7O
    6vr6/mqCztba9jZy3kJi1nKq/r7C1uL+/pK6+gomvhI60v7+/oq2+r7W+pa++hJC3ipGvkp+4oKq9jJy8gI63u7u+sbG5ipm6r6+3lqe/l6a+qquziY6ykaW
    /qrO+kZy5g4qypaezjZm1tra7mKG3gYyth5q8hJS0qLS/ub+/rrm/iJi1maS6uLy/n6Kyj5a0rLa/q7C8uLi9sby/iJW0gIiyqKq3m6q/hpGvnKCxkJexiZS
    yi5q2kJq4k565n6i7ubm9oau9goy0m6m/kqG9lKK+jpy3q7S9naa5mae7tre+r7u/sLC3nqy+kJ+9p7S/ho2ujp29srO7sru/pq68g4yvu7+/s72/jZq1pKe
    1r7C6mae+iI2ysrK4t7e7iZm2jp23m6W5gJC5s7S7o669maK3maW5gImzn6m7oay9nq2/oK6/hpCvtr2/srO1k6e/q620h5i1pbS/iJOxi5azipm2pbC9iJa
    0nae6nqi6rKy2ra22gIqyrq63i5GxoKK0rLS+n6m9r7q/o6SyiZi1j523ubm+rbm/tbW7iZi8sbu/o62+hZS0r7m/mqS5rLS8t7e9pae2nKW5gZC5tLS6u7u
    /vLy/qqu0srK5t7e8nqi7jJu3hpa1gI6yr6+4uLi+sLC4nqy/o6SztjY2NjY2NjY2NjY2NjY2NjY2NjY2CH5BAEKAP8ALAAAAAAWABYAAAj+AP8JHEiwoMGD
    CBMq/EcMH6ECCw1mwIfFHIaIAylggCWCxZpzLwoeEwDlEw8n4v61C8GN3ToW3NYdgDhwWytwoRZIYKbBXRgrLmFyY/OIy0BbrRJhkzCCkYifIoJyq7euWpyB
    WZLSedUkjNef7NixwLJrl54OV5AgyZpoSa6vUF2CUiTo0iU08OCtinfTzwpfvp458+QJBblmAoDNkVGMDwhIkhAkSnHr0BhrdKaQ0fVLjJE5oBNgAuBDUlIG
    VEBR6YKg24lgjd7IANIGDCZZLrjUahXszJ9h5cCVmhFrExAaT8r0WnRBlpl/2lp5UEVFSSkHDrbA0ZQmCgwpUpiPB4EAfUEEVqFaIBu1JZMKUjRwwfje68KX
    kCQs6EGQapyhKV6EU8kulNQxiRaFmGCGKQKRYMsOX1khwhrcmJOHOkKwQU800HCAg0B9iAOXhC/VY443VbABixvQ1HCHQPPcAlcYInxgCS3qzMKFDhnEMcAi
    A82jTQCuuIIHHsooU0QkkdTgiDA2GLDHAxhFFBAAOw==
}]
set toolBarImage(save) [image create photo -data {
    R0lGODlhFgAWAOcAABIWRlZmiuLm6oqWssLK2iYuWpqmvmJylqayxk5Wfuru8nZ+ojo+arbC0o6Ops7W4rKywu7y9n6OrpaWrkpSerK6zh4qUqamukJOcpqa
    rvb29oKCmqKuxrq6ymZqjpaivhoiTlZehkJCbtbW3srK0sLC0i4uYq66zsrS3m5ylq6uvn6Kpp6iujIyYr6+yh4eTlZulpKeump2lkZejnqGojZCavr6/oKG
    ptbe5q6yx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FS4kz
    ARCBISinyQkbEfKsUjTiUS1AJezgMVRj9cBWCBCYKlEi0CVVf/5sSYXGVqFDsAhOmfTB1KhasyLR+rLoD6o9Wyh28Io+0EcMKbee0LrEHdMWNGhO+cFQwAvB
    FAPKjIrE/o+oLXuU4gcpjMRhgX0DebDCLlrQgscXKrhXESOkhFEDCJIQFEInm7jAA0QXOKLLBEE4IMcGLQCQ4UAZiEDJFVeYYUYVVfgigghKUMLAC5JModCP
    QAYZEAA7
}]
set toolBarImage(saveAs) [image create photo -data {
    R0lGODlhFgAWAOcAABIWRlZahv6mOsamTv7uVvqmSsaCSsrS3oZqatqiciIqUv7ucp6uxr5+Uv66Tt6iev7ugv6+Bn6Cpi46Yu7Gqv7qltaulqq2yv7Gao6e
    tv7eAv7qwpqitmp2ljpWhpaGira2xu7y9vLajtKOUsamlqp2YoKSsrbC0trOsv7iFv7KVj5Kcubi2v6+PvbSpraGdr6ylta6Xk5mkvraSoKCoOaKMurOsnZ2
    kv7uzjY+av725v7ODrKqkrKSgs6+uoKKov6qGv6eJpaSshIaQtbe5v7WbrrC1lZmiv7eKv7mYKqirvripqquwsrK0rq6yjpGbkpWeoaSrjI2ZhoiTva2aurq
    6v6yJv7ONtLS1Ipyfv7GKvrmzv7iimJmjsLK2tra6v768qamvaKaprKamoaKqsaObpKSqpqqwnJ+nsLCxsbG2O6aRkZOdsrK2rK6ztKmis7W4vLSJvrePjIy
    Yq6uwnaKqjpCbsKusuqmaua+Wp6OnIaOqiIiU/LaXrq+zkZGcSYuWHZ+nNri6v7Siv7aUmJuktbKxpaeuvraalpulqqqvv66Ev7mNsbGyr6Sgv7WJtbW1vra
    klJSev7GBv7+/v7KHo6Oojo6ara+0h4mTsK6xo6Opj5Cbq66zsLC0oaGouru8o6Wsvb29v7itu66ev7ORr6+0kpKdJqatiImVt7e5l5miuLm7tLS3uKmbioq
    WqKiunJ2mp6Kku6KKhoaTtLOztaqkn6OrmpulrKyxE5Odq62zfrWWv7edsKqovr6/s6qls7Ozj4+alJehrq60jI+Zv7iBnZ6kpaWsKayxs7O3tLa4ioyXvrW
    gp6etIqOroqKpvaqUm56moaWtsbO2raennKCpv7ebvrOHl5qjv7aXtrW0p6qwr6+zUJCb46OriYqWpqGkra2zoKKqv7eRnp+ov66GqKuxvLy9tbS0ra6yu7u
    8iYmVlZegoqKqpKSrjI6Yp6iujY2ZtLW4nqKpmZukpKWsnp6lv7Wgr6+1j4+boaGps7O0rq6zurq7tjY2CH5BAEKAP8ALAAAAAAWABYAAAj+AP8JHEjw37Y8
    pB5YMFSwYUEUcZJsoPAmHcEmfpx0o6MoTEdYqAZomGSuQJlaBP2wYEWpjrVplGKCqaQhApAaWY4RVEeECCUPiUzEpBTJ2I5FQRr8+EMw1zyfMkwwiKljhoZK
    VmZ9CKSPIJMDXyid8TMv5pIUj7QIwLOvUNeBYahRCwGKLih/vBhdabGGBJpVlwg684LJCKZOu5LBkEOulAMDxwoFkELwkJFOF86dO8MhBgFeKqIhSDQMijyB
    kCDZw3Th8IVkPPok0YZhxI0Ow9jMwdKkSbBnnYxQAoOuiogF14pQIdHNzzA7r9JIT0PmwglK6PyxKFLh2iBXd0Cy5GIzAdz0NBLOJfuiJp+mZhV6DXqBbJOZ
    FVLYTW9Ujhu3L8q04YMLOIySgB7vvBOKHeCkIl0TWMSSQQbK5NOPLzZsYUE47pBBwyfFKMBHMKn9g0sUobRBjDjV9OBION+4s8+HxWTCB0Gr0LOHGsSAMEYJ
    srzzzT5EPjPBFDcOFIA0gXQDAh1KiOEMKmZYAs0nNAAyRJICmeGNMJKEecopf5TpzZeX0AKAJQ616eabcA4UEAA7
}]
set toolBarImage(print) [image create photo -data {
    R0lGODlhFgAWAMYAALa2try8vMTExMPDw8LCwr+/v8DAwKCgoM3Nzbm5uezs7P////z8/Pj4+PPz8/T09KysrMfHx/v7+/X19fDw8Onp6erq6qqqqrq6uu3t
    7fb29uTk5N7e3qmpqb29ve/v79jY2MjIyNHR0bOzs+Li4ubm5uDg4Nra2tXV1c/Pz6KiorW1tdLS0ri4uK+vr62traurq6ioqJ6enpmZmZaWlouLi7KystfX
    1/r6+ujo6Nvb25ycnNTU1MbGxsXFxdXU1f7+/vn5+evr68zMzMHBwdbW1srKyrfht6rgqvf89/f3967grpvam/T59Le3t+7u7vb19uPj4+Hh4eXl5efn593d
    3Z2dndnZ2ZqamqWlpcvLy8nJyWpqajIyMjExMTAwMC8vLzQ0NHx8fJubm7CwsFBQUA4ODkdHR5eXl5OTk5CQkIyMjIiIiENDQxEREWFhYaOjo6GhoZSUlNzc
    3LGxsZiYmPLy8tPT05+fn9DQ0NjY2NjY2NjY2NjY2NjY2NjY2CH5BAEKAH8ALAAAAAAWABYAAAf+gH+CggABAocCAwQFBgcIg5CDCQoLlQsMDQ4PEBGRkZOW
    EhMUFRYXnZ6DGBmVEhoUFhsbp6mDAayisBscHB2otR4ZDBofsRwgIB0htX8iIyQUCiUmJygpCCorLLUtCRAuLzAxKjIzNDUrNpE3KAgFOA/xDx85JDrWKTsI
    PIIoPT4/HlhaAISBBBxBGmiYIGSIByJFfBg5giTJwIsXlQTo4WHDEiZNJIgcSZIkgxtOXDyBAmWCy5cwY06IEgOCCSlTqOQoZaGnTwsVclDZIKWKlQvsUKAo
    cgPZladXkN0oonQpliwItPggQICI169guUbQsoVGDAMGuHTx8gWM27dxbr94CSOGQIsxGMg4KWPmDA00gNHQSKNmDZs2bt4kyPJiC5w4O+T0CEKZsoMnVEjM
    oZOmzo40Pm4YIbNDhh1LQHBcpiJFhxY1cmL0KDLoToIPT3IrqFflBoshRnag8MSiA5zjcFTEwSPDyhgs0PMMCgQAOw==
}]
set toolBarImage(configuration) [image create photo -data {
    R0lGODlhFgAWAOf/ABAvXVZaXFhfZilj0ztkzzJp02NoakVs0mZudT1x1TV132pyeWZ1h0101EV41mh3iUh62Ep82nJ5gW17jVl8yGN/oGd/qFd/2G2Al159
    0VGD216AzWR/x1qB2m2EoXCDp2+Go3mFkl2G2XyDl36FjV6H2nGIpWSIz2CI21iM3VuL5EuS71mP2maMzGuLxnKLtGGP1GqL2WSO21eS6nOPsYGNmliT62yN
    23OOw3iQrYuNil+U322O3H2QqGGT5nORwIqPkoKRpF2X8GSW6XCT24yQn5CSj3KV3X2Wv3KX2GyZ34+TomKe72mc6G+b4nCc43Sd13mc0JGZoZSZm3mb5G2g
    7Xue0n+b3nud5nWh6G+j75ScsIGd4IefyY+evYufw3+i14eixp2fnH2i5ISg5HKo7p+hnoKl2pahu4ek1J2ipHum7ouh33+n4oan0JiksXqp6ZCkyYunyoKm
    6ZaluHar8X2o8KKkoYem4oOo6pSnzImo5ZCo04qr1Iqp5o+o4ISt6Iuq54qs4pqpyaeppoyr6JGt0JGr4qmrqKOstIOx8pms0pOt5I+u64mx7KmusI+y6JGw
    7qCvz5Ox75az5Ja34JC49Ju07Kq1w5a476e3ypu46LC4wKW43qG55Jm78p677LW6vK+7yKC97ra7vpy+9be8v6DA6p7A97q+zqnB7bvAwqXC9KzD4r7BvavD
    76jE9qzE8K3F8arH+KjJ88DFyMDE06/H86vI+cfEybfK5LLK9rPL97fL8cbMzrPP9MrMycHM57TQ9cLO3LnQ78TQ3tDN0b3Q98XQ7MPT58zS1LnV+r7W9cvS
    6L/X9srW5NPV0sjX68TY8dHW2cfW98HZ+MLa+dXW4NbY1dPX59Xa3M7Z9c/a9tbb3s3d8drb5dTc8tne4dnd7dXh797f6d/h3tzi5Nzg8ODi3+Hk4N7j89/n
    8OLn6uLm9ubo5efo8ubr7uzq7uft7+nu8Ovs9u3v6+vw8+/x7u3z9fHz8PP18vD2+PT38/f59vn7+P///yH5BAEKAP8ALAAAAAAWABYAAAj+AP8JHEiwoMGB
    KPAwWsiwoUM/MQSKyBZvG7eL3MCti/fuHEZu2759O/FvTLBizqyp9BZP3rx99capVBkt259/bHgdo+bMWbVw9zj628dOms9jwnod+nclFq1ex6KaO9dvmr93
    8ZohPbYrFp5/R0CxwjVr1i9o+/r5G1pO16xds1h94vKvQaBPqDIp0vLGWL+08VadQjUY1KQj/wooSGFIkx4fRKbkwmZMDJI6rYoN25QHxT8CDjB1C1YO0wwZ
    H3rkaKHCTTdx5pTxUfEZRyog6eLZimJDiA0VK4aYOlcPUbZUFxIjmRaPHb5rXWwMYTJkSJJcWPWtIwXh3wEXudL35nMFRUt1JkyaPIrXT183L8kToPBCylgo
    L1q0lHHiJP+ZR8bk8kYMDdQ1RBV/8NFGHQwyYAYCZdhRRx5uuIHFEN1dQAUcL3gAhSKK2DECIQLAASIeH3iQRxYd/HPBHI3UgMgHlliSyQRqBCBIJpa4cYcE
    hZDhmQiNZDKCER+MggooRRizACSlfJIGEAhAwggP/6AwySd0mAICLqfAcooUDJwyCyyduELCJp8Q8Y8Mi9DRyQhy4EKLLLcsoscptNAyCxojDLIIYhl4sUQs
    raiyyy2M3iLLonh2ogodRVAg0AZskBHJIWxE8kchhxTS6aeB+IEHBwAEBAA7
}]
set toolBarImage(refresh) [image create photo -data {
    R0lGODlhFgAWAOcAADJu3naWztbi9pqmurK6xnKSyrbK6l6GzuLq9lqGzsLK1nqe2jp+/uru8sLS8k56zoKm5qayysrS5u7y+mKS5j5y0q7G8kKG/oam5m6S
    zvL2+srW7sLCwqa2zlqG1vb2+pq25q7C7kJyztLe9tLa6m6e9qrC6k6G6jZ69mKa/m6OyrbC1oqq5l6O7qK21qaywvr6+kp6zsbK1mqW6nae6uLm7lqS+tLS
    0srW8pay5p624lqCzq6+0lKO9tri9kJ21m6a5qK+7n6i4pqqwr7S8pKy6vr+/s7W5tbW1srKyj523tLa7rq+zkaG9r7G0jpu0kZ62r7O7lJ6ypKu5p6uxmaK
    yjqC/sLO5l6S8nqm8kZ2yjpy2lKK+oau7srO0p667nqa0maa9rrO7laK7trm9mKW7lJ+ztre6mKK0lqO8oKq7o6u5sbO1qK64s7a9rK+0sLW9vb6+nai8kqK
    +sLGylqW/j5y2nqi6ubq8t7m8k5+1s7a7pq27kJ23nKa4qKuxj6C/mKS6ubu+nqW0v7+/lZ+yjpy4rLG7tbe7o6u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xgSRUvJHGjQ0jcEEEGhWihyAMiPODKAByk4hNBSCCRCgEDDCHLHwRwkESS
    BAUEADs=
}]
set toolBarImage(help) [image create photo -data {
    R0lGODlhFgAWAOcAAMPH1JKfzXew4tLT16Gt1cDJ5kGa6H2w4LS70quz0ejs+ff5/6av0KW404G04Xu48IiXzI2bzM3P1v///7jB4srM1aew0Dx4zSBrzqS3
    0sLP2lSr85Wo15+p0eTo9qmz2ujr+Iqbz3yt6FaEyWyr453D7ZCdz/7+//39/6ax2vn5/6y23Jez4hlgx8rP1qzF3Gqx8I2cz6Gs19je8vz8//b2/s3U7NXZ
    7tTY7l+a4nmYykWW45+44rC63/j4//T0/PPz/Ku125ej0pC26SNev4ix23y17e/z/fr6//b2/fDw+u3t+OPl9L3E442f1Dx60pSmy8zS2D2Q45On16iy2vf3
    /u7u+Onp9tvf8rvD4uDh8n6t6UNou2Ka2I226NDW7dLX7vX1/e/v+evr9+bm9KWv2erq9pKx4hVSvLzC0rTE11ad5oycz/Ly+ujo9eTk8+bo9qOu2Onp9cvP
    6V6V4WuBv0OG1ZSz4sTM5uHj9OXl9K643tfa7pWj0oqx6BtHsY2s03St6qiz2/n6/7i/3+zs99jc8LrB4bnA4Yyf1Dtzz5Sfx8vQ1y930YqYzMvR67rC4OTl
    9OXl86my2cbM5qax2YCx7DZRsKS40z+D2JSo2JKezsPL5MvP5rnB4Nrc7+Xm9cPK5pil1Iqe1Iq78wI7r3udzVqV4Jel0qKs1K6319/i8sDG4rjA4JOh0I+s
    32ub4C5oyUNcs1J+xXOj4Z2o0KSu0ay11qaw1Zmlz5Oj0Yim3E+D1BFGsmt9vbzB0crO1jFnwYar4Ke74Ky31qe22YCl3jJnxjZSsIaUxLzE0xxYvSNfxE2H
    2SJYvF52u9jY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY
    2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2CH5BAEKAP8ALAAAAAAWABYAAAj+AP8JHEiwoMGD
    BAEEQChQAMIBBAoAYGjgAIKJBBMoWMBgYIOCDh5AiCBhIIACEyZQqGDhAoYMBDVs4AChg0CIKSd4+AAihIgRBUmUMEEhwT+NKU+gSKFiBYsWLgi+gBFDxowE
    FHLSqGHjBg4IOXQU3MEDgoIeCpL6+AEkCBAhQ4gULGKE6JGsE5AkUbKEApMmTp5AIRhFyhQTE6ggQVEFiJUrWLJogbCFS8EuXkx8mQFGRRgxY8gsKWOGyhk0
    aQiqWcNGRuIqbZa4eQMnjpw5EOjUKWjnjlk8ecSY0SNnDx8yb/r4+VMQUCATggYRKjTb0CE3et4gSqRoEUFGjc5qOHoEKZKkJZPMkJFDqZIJS5cKYsqkaROn
    TnI8fQIVShQECKOQUopBppyCSiqqrMJKK6789wosscjinUGz0FKLLbfgkosuu/DSiy+/MARMMMIMQ0wxxhyDTDIMEaTMMsw048wzIbZo40EBAQA7
}]
set toolBarImage(exit) [image create photo -data {
    R0lGODlhFgAWAOcAAJJGPvbm3r6qpqJeVsqKYqZ2burOwr42IroqFsJ6TurGsvbq4tKefro+IrpeNtaifvry6sJuQua+ptKadrZKJsaGXsZWNrpWLs6WcsZu
    SspiQtaCYt6qjpJOQv728tqKbtJ+ZvLazs6KZsaCVs6Sbr5qPqp2csZySv769taGYrpmPsJyRs5ySspmQtKKapZSRsZiQsZ+Vu7SvsI+Kt6ylrZSMtqSdsJ2
    TsqGXvLe1tqegsJ6Wvru5v7++s52Ts5+XtamisZ2TrpiNrpaMu7SxtaWdtaSdtKObsp6VubKvs5uStKaftKCXspqRurKus6OataeesqGYsZ6TpZOQsp2VpZK
    QsqCWvLWypJKPqJiWsqOaurCrtqultaKZsp+Vr5iPs6GYpJKQurWxr5mQtaKbtKSbvLi2sqKZtKWcuKyltqmhrpiPpZSSs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NwQQjmoxyB2Gk4IAGAaUotsAgDDDQQhh9MdFIEIHY8aFcRJjRgx48qEEKJJBoQF8H
    IDDSSAw3sCKDal05IsMeE2BSCiQWsDiAITjcgB0gMaDBBQ00TILBIHsAwYUiDWTxjwAH7IBDJKJUcEYUOBBwxpcM8PhEDQhY9E8BB8DgwyInsJCBEko00UQL
    LcBgQQMIoDRQQlhMMUUYk4ZRBRZYAJBpRQIFBAA7
}]
set toolBarImage(record) [image create photo -data {
    R0lGODlhFgAWAMYAANbW1tPT09LS0gAAALS0tMfHx9XV1Q0EBG4gILMzM949PepAQNk5Oa0sLGcZGQwCArGxscjIyGEdHeJCQtgqKsYSEr0EBL0AAMIEBMwP
    D9YhIdAvL1YTE5+fn8XFxdTU1H0mJuU5OcEODrgAALoAAMAAAMMAAMYAAMkAAM4KCtYlJW4WFp2dnbkFBcsAAM4AANEDA9QhIVIPD9EAANQAANUICMIiIgsB
    AXBwcNcAANoAANIVFVsODpWVlcbGxt0AANkJCZUVFd8AAN8CArgZGV5eXqqqquIAAOUAAMIYGFtbW6ioqOUBAbMUFOgAAN4GBo4ODusAAM8LC1UHB+MEBK8P
    DwoAAD09PeoBAcQNDUgFBVNTU14HB0BAQD4+PmZmZlxcXKmpqf//////////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////yH5BAEKAH8ALAAAAAAWABYAAAf+gH+Cg4SFhod/A4qLAwQFiIMDBwgJCgsMDQ4PAxARiAMS
    ExQVFhcYGRobHAMdHoYDICEiIyQXJSYnKCkqKwMsrpESIS20trgoLi8wMTKsnoIHE7O1t7nJMzQ1Njc4EAKJCBTF1cgv2Dk6OzwDPT6JCRXUx9c06D9AQQM4
    BIkKpeT07AkZQmRAESOJFhizZq6ejh9CjiBJMkDJkkQMMMxrKFAikyYVLw5okIHhuYcRkTh5AiVkIgcayp2EKNFJFClTDCIk8GBDCo4oa0ahUsXKlX1/Cgzg
    oAKGQ5oqo2DJomXAlnaCIAxYEaNG0KhUsnAZ0KXboAgdBsiwsQPIECRFTJ5IqVLVy5cOzwR5YDHgBo8gRJI0gTLFCtkvvwx56ICD0aIrW3C0QhQBQg8cRcAo
    UVIER49OkP4IKEDASJglS4w4MhQIADs=
}]
set toolBarImage(recording) [image create photo -data {
    R0lGODlhFgAWAOcAANTV18fM17bB1rC91bbB1cXL1rK/1nqZ1FuE0kh40UB01Ud3z1qDzniX0K+809bW1sHI13iY1D1z1z934FaL722e95Sy6p2353ql81qP
    8Ud62ztv01+GzbG80cPK12GI0zJv4GKR6azG9tnj9e/z+vL1+/H1++Do977Q8nWe6jhx2Ux6zae1zj9334as79Le9eTr+OXs+drk9qC77Eh72Up4zLK80NfX
    13WV0zJv3oOp79Hd9Nfi9tfh9dfi9dXg9Zu37Dxz2G6PzdLS0rK/1T1y1WGQ57vO8MjX8oKm6cPT8XSd6D5y0qa0ztTU1HqZ0UB33JOz7bjM7rnM7/8iIv9G
    Rv9XV/86Ov8WFv8CAv8AAL7Q8LbK7pu25Ud62HCQy8vN0MfM1luEz02F7KO76arB6/+YmP+5uf9+fv8uLv8JCV6U91CL+Dl68VN9zLi/zEh3z2GS7Zq155m1
    5/+Xl/83N/8LC1+S8TuA/zl+/EJzzaayyGuX6Iqq5Yyr5ZKv5v9mZv8lJf8HBzp//T1x05+txl2P7XOb53ad54Om6P8NDTyB/zt//Z6sxUaE9lKM9VKL9VGL
    9j2C/zx//EJyzKOuxTd69EOF/UCE/0KE/zZ59VB7yrG5xzhz4UiI/EmI/GyMyMLEyD5z002F616S8WKU8T1w0Zupxc3NzXSUz0B11m2Y53Sc6HOc6GaIyMTE
    xNPT073F1F2Ezk9+1nyg4oKl5oKm5lZ+yqexw87Ozr3E0l2EzUp60nOZ4Yys542t6FZ+yaqywsrKyrrC0W+QzUZ2z1iE13qc246t5ZGv6ER1z0R0y0t4zURz
    y9jY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY
    2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2CH5BAEKAP8ALAAAAAAWABYAAAj+AP8JHPgPQAAB
    AwYQKACAoEOCBg4gSKBAwQIGDRw8eDgQQgQJEyhUsHABQwYNGzh02OjQwwcQIUSMIFGihIkTKFKoWMGCpUAIH1q4eAEjhtGjMWTMoFHDxo2BOHLo2MGjqtUe
    PXj4+AEkiJAhT4kUMXIESZKzaNMiUbKESRMnAJ5AiSJlShIqVaxcwZJFi5YkW7h08fIFTBgxY8iUKZOkipkzaNKo8ZtkzRo2bdy8IQAnjhw5c5JYOXOGTh07
    lO/gwZNHz54BCvj08fMnyRU0dAAFEuT3jmo8gwgVgm3oEKJESbCkqRNIkV8tqhctYkSoEYEFjh5BghQpixo7vJ+7R5c0iVKlAgwsXVp/6bl76HgwZdK0iROA
    Bp08fdr/XjweT550Akoo/zggyiik+Kbggr6VQsooppyCyj8PpKLKKqwswUqGGrLSyhIarqKKK6/AIlAsssxCSy0s1mILi7a8SMsst+CSy1P/3KDLLrz04ssv
    QAbpSy+8ABOMMD5ROAwxxRhzDDLJJIPMMcYo4wouwjjx0A1DNPGFG8sww0wzm4Byyiu5JEnQDU6A8cYehTRSCSehoAILjgIFBAA7
}]
set toolBarImage(stop) [image create photo -data {
    R0lGODlhFgAWAOcAANTV18fM17bB1rC91bbB1cXL1rK/1nqZ1FuE0kh40UB01Ud3z1qDzniX0K+809bW1sHI13iY1D1z1z934FaL722e95Sy6p2353ql81qP
    8Ud62ztv01+GzbG80cPK12GI0zJv4GKR6azG9tnj9e/z+vL1+/H1++Do977Q8nWe6jhx2Ux6zae1zj9334as79Le9eTr+OXs+drk9qC77Eh72Up4zLK80NfX
    13WV0zJv3oOp79Hd9Nfi9tfh9dfi9dXg9Zu37Dxz2G6PzdLS0rK/1T1y1WGQ57vO8MjX8oKm6cP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ZL25AgQQNKsCAUKHnhYpT6WzoEKJEigA0WMSokXfpnRmVMVrk6NE/B5AiSVrNvv3qSZIiUapk6d+D
    S5gyaVqiaT9/TZsswV8mmHDSiScCfQJKKKKM4uAopDhISoSihFKKKac89c8NqKSiyiqstCLiiKysooorr8Dik32xyDILLbXYcsstttRCCy6cmAKLEw/dMEQT
    WYyRiy667JKII5V0csqKBN3ghBZktEHHHoMo8oglnmgoUEAAOw==
}]
set toolBarImage(play) [image create photo -data {
    R0lGODlhFgAWAOcAANTV18fM17bB1rC91bbB1cXL1rK/1nqZ1FuE0kh40UB01Ud3z1qDzniX0K+809bW1sHI13iY1D1z1z934FaL722e95Sy6p2353ql81qP
    8Ud62ztv01+GzbG80cPK12GI0zJv4GKR6azG9tnj9e/z+vL1+/H1++Do977Q8nWe6jhx2Ux6zae1zj9334as79Le9eTr+OXs+Yap6drk9qC77Eh72Up4zLK8
    0NfX13WV0zJv3oOp79Hd9Nfi9v///9fh9dfi9dXg9Zu37Dxz2G6PzdLS0rK/1T1y1WGQ57vO8MjX8snX8liS+cPT8XSd6D5y0qa0ztTU1HqZ0UB33JOz7bjM
    7rnM77bK7pu25Ud62HCQy8vN0MfM1luEz02F7KO76arB66e+6ous516U91CL+Dl68VN9zLi/zEh3z2GS7Zq155m151eO8juA/zl+/EJzzaayyGuX6Iqq5Yyr
    5ZKv5kKE/Dp//T1x05+txl2P7XOb53ad54Om6IKm6XWf7V2R8TyB/zt//Z6sxUaE9lKM9VKL9VGL9kSF/EOE/EWG/z2C/zx//EJyzKOuxTd69EOF/UKF/0GE
    /0CE/0KE/zZ59VB7yrG5xzhz4UiI/EmI/EKE/kGE/UaG/GyMyMLEyD5z002F616S8V+S8WSW8l2R8j1w0Zupxc3NzXSUz0B11m2Y53Sc6HOc6GaIyMTExNPT
    073F1F2Ezk9+1nyg4oKl5oKm5lZ+yqexw87Ozr3E0l2EzUp60nOZ4Yys542t6FZ+yaqywsrKyrrC0W+QzUZ2z1iE13qc246t5ZGv6ER1z0R0y0t4zURzy9jY
    2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY
    2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2CH5BAEKAP8ALAAAAAAWABYAAAj+AP8JHPgPQAAB
    AwYQKACAoEOCBg4gSKBAwQIGDRw8eDgQQgQJEyhUsHABQwYNGzh02OjQwwcQIUSMIFGihIkTKFKoWMGCpUAIH1q4eAEjhowYSJHOoFHDxg0cA3Po2MGjh1Uf
    Mnr8+NEDSBAhQ4gUgWrkCJIkSpYoUeLDB5O1apU0cfIEShQAUqZQqWKlr5W2bv1auYIli5YtXLp4+QKmcWPAbsGEETOGTBkzZwigSaNGzRrPaiC7lcGmTRs3
    b+AMUBBHzhw6sOmIdlvHtJ07eFbn0bOHTx8/f2b7AEQ80B1BBBYMIlSokKFDiGYnIq5oEaNGBRg4esT9ESRIoiOyEZc0iVIlSwAaXMKUqX0mTZAjbeLECROm
    S508/XPwCVQoUQAG19YopPwnSiiglGLKKf88gEoqqqzixCqrtEUhK05MqEoqrbjyikCwxCLLLLSU6EMtJdaC4iyy2HILLlD9g0MuuuzCSy++5KhjL7zs8gsw
    wfjUoDDDEFOMMccgg8wxxhSTTCu3BBPFQzgUAYUWZiizzDLMVNKJKa7gIiRBOESxxRlw4CFII5Z4csorMQoUEAA7
}]
set toolBarImage(playing) [image create photo -data {
    R0lGODlhFgAWAOcAANTV18fM17bB1rC91bbB1cXL1rK/1nqZ1FuE0kh40UB01Ud3z1qDzniX0K+809bW1sHI13iY1D1z1z934FaL722e95Sy6p2353ql81qP
    8Ud62ztv01+GzbG80cPK12GI0zJv4GKR6azG9tnj9e/z+vL1+/H1++Do977Q8nWe6jhx2Ux6zae1zj9334as79Le9eT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YKlL5YsWrY48YuFSxcvX8CEETOGTJnHj82c0eK2DJo0atawaeOGwBs4ceLIER1njpks
    THw4kUGnTh07d/AMUJBHzx4+uPn08fMHUCBBTga5JlTI0OxDiBIpWsSokaNHkCJJmkSpknVLhS4RWIApkyZNmzjTdfL0CVQo6qKsjyJVylQBBqdQyUeVKpWq
    +9RXWWfVytUrWAA0EIsssxQ4Cy2UJEjJKrXYYossssRyCy7/OJCLLrvwomEjCvbiS4a87KLLL8AE888DwgxDTDFQFFNMgi4aA0WLxAxzDDLJCKTMMsw048yP
    lDzz4zNCNsMMNNFIA9U/OExDTTXWXIPNlFReY0012WizjU8nctONN9+AE4444oQDzjfjHBPNNlM8hEMRUnzRBjnllGPOK7cAg4w0XBKEwxRguIGHIZeYAgsu
    wSSzpEABAQA7
}]

proc initializeMenuHelp {} {
    if {[info exists ::menuHelp]} return
    set ::menuHelp(file,new) [mc {unload all modules and remove all viewers}]
    set ::menuHelp(file,open) [mc {load dashboard from a file}]
    set ::menuHelp(file,saveAs) [mc {choose file for saving dashboard configuration}]
    set ::menuHelp(file,print) [mc {print dashboard window}]
    set ::menuHelp(file,exit) [mc {close main window and exit program}]
    set ::menuHelp(edit,configuration) [mc {edit current dashboard configuration}]
    set ::menuHelp(view,refresh) [mc {refresh display of all synchronous modules}]
    set ::menuHelp(view,refreshDatabase) [mc {update display from database according to cursors positions}]
    set ::menuHelp(help,global) [mc {global help for user}]
    set ::menuHelp(file,database,load) [mc {display cells data history from database}]
    set ::menuHelp(file,database,record) [mc {start recording cells data history in database}]
    set ::menuHelp(file,database,stop) [mc {stop recording cells data history in database}]
    set ::menuHelp(file,database,record,disabled) [mc {no cells to archive: edit database}]
    set ::menuLabel(edit,newViewer,::dataGraph) [mc {&Graph chart}]
    set ::menuLabel(edit,newViewer,::dataStackedGraph) [mc {Stacked graph &chart}]
    set ::menuLabel(edit,newViewer,::dataOverlapBarChart) [mc {&Overlap bar chart}]
    set ::menuLabel(edit,newViewer,::dataSideBarChart) [mc {Side &bar chart}]
    set ::menuLabel(edit,newViewer,::dataStackedBarChart) [mc {&Stacked bar chart}]
    set ::menuLabel(edit,newViewer,::data2DPieChart) [mc {&2D pie chart}]
    set ::menuLabel(edit,newViewer,::data3DPieChart) [mc {&3D pie chart}]
    set ::menuLabel(edit,newViewer,::currentValueTable) [mc {&Values table}]
    set ::menuLabel(edit,newViewer,::summaryTable) [mc {Statistics &table}]
    set ::menuLabel(edit,newViewer,::freeText) [mc {&Free text}]
    set ::menuLabel(edit,newViewer,::canvas::iconic) [mc &Iconic]
    set ::menuLabel(edit,newViewer,::formulas::table) [mc {For&mulas table}]
    set ::menuLabel(edit,newViewer,::predictor) [mc &Predictor]
}

proc updateTitle {} {                                                          ;# show modules and poll time or mode in window title
    foreach {loadedUserModules anySynchronousModules databaseConnected databaseMode anyRecordableCells} [userInputStates] {}
    if {$databaseMode} {
        set title [mc {moodss: Database history}]
        wm title . $title
        wm iconname . $title
    } elseif {$loadedUserModules} {
        set names [modules::namesWithout [list formulas peer]]                   ;# do not display formulas or peer modules in title
        if {$anySynchronousModules} {
            wm title . [format [mc {moodss: %s data (every %u seconds)}] [commaSeparatedString $names] $global::pollTime]
        } else {
            wm title . [format [mc {moodss: %s data (asynchronous)}] [commaSeparatedString $names]]
        }
        wm iconname . "moodss $names"
    } else {
        wm title . moodss
        wm iconname . moodss                                                                      ;# give the icon a meaningful name
    }
}

proc updateMenuWidget {{parentPath .}} {
    static help
    static cache

    initializeMenuHelp
    foreach {loadedUserModules anySynchronousModules databaseConnected databaseMode anyRecordableCells} [userInputStates] {}
    set moduleNames [modules::namesWithout [list formulas peer]]         ;# formulas and peer modules not taken into account in menu
    if {[info exists cache]} {
        set change 0
        foreach {name value} [array get cache] {
            if {[set $name] ne $value} {set change 1; break}
        }
        if {!$change} return                                                                ;# avoid updates when there is no change
    }
    foreach name {
        loadedUserModules anySynchronousModules databaseMode databaseConnected anyRecordableCells global::readOnly moduleNames
    } {
        set cache($name) [set $name]                           ;# the menu configuration is uniquely determined from these variables
    }

    set menu .[string trimleft $parentPath.menu .]                                   ;# remove double dot when parent is main widget
    if {[winfo exist $menu]} {                                                   ;# delete all entries and destroy all related menus
        for {set entry 0} {[$menu type $entry] ne ""} {incr entry} {
            destroy [$menu entrycget $entry -menu]
            $menu delete $entry
        }
    } else {                                                                                                 ;# create menu bar once
        menu $menu -tearoff 0
        frame $menu.bound                              ;# create a frame for bindings that otherwise would propagate to all children
    }
    if {![info exists help(bar)]} {
        set help(bar) [new menuContextHelp $menu]
    }
    set index(bar) -1

    menu $menu.file -tearoff 0
    if {![info exists global::fileMenuContextHelper]} {
        set global::fileMenuContextHelper [new menuContextHelp $menu.file]
    }
    set index(file) -1

    foreach {string underline} [underlineAmpersand [mc &File]] {}
    $menu add cascade -label $string -menu $menu.file -underline $underline
    menuContextHelp::set $help(bar) [incr index(bar)] [mc {file related operations}]

    unset -nocomplain global::fileMenuContextHelperSaveIndex
    bind $parentPath <Control-n> {}                                        ;# first reset bindings which may be optionally set below
    bind $parentPath <Control-o> {}
    bind $parentPath <Control-s> {}
    bind $parentPath <Control-a> {}
    if {!$global::readOnly} {
        foreach {string underline} [underlineAmpersand [mc &New]] {}
        $menu.file add command -label $string... -command clear -underline $underline -accelerator Ctrl+N
        bind $parentPath <Control-n> clear
        menuContextHelp::set $global::fileMenuContextHelper [incr index(file)] $::menuHelp(file,new)
        $menu.file entryconfigure $index(file) -compound left -image $::toolBarImage(new)

        foreach {string underline} [underlineAmpersand [mc &Open]] {}
        $menu.file add command -label $string... -command reload -underline $underline -accelerator Ctrl+O
        bind $parentPath <Control-o> reload
        menuContextHelp::set $global::fileMenuContextHelper [incr index(file)] $::menuHelp(file,open)
        $menu.file entryconfigure $index(file) -compound left -image $::toolBarImage(open)

        foreach {string underline} [underlineAmpersand [mc &Save]] {}
        $menu.file add command -label $string -command {save 0} -underline $underline -accelerator Ctrl+S
        bind $parentPath <Control-s> {save 0}
        set global::fileMenuContextHelperSaveIndex [incr index(file)]
        $menu.file entryconfigure $index(file) -compound left -image $::toolBarImage(save)
        if {($loadedUserModules == 0) && !$databaseMode} {                                ;# saving is also allowed in database mode
            $menu.file entryconfigure $index(file) -state disabled
        }
        foreach {string underline} [underlineAmpersand [mc {Save &as}]] {}
        $menu.file add command -label $string... -command {save 1} -underline $underline -accelerator Ctrl+A
        bind $parentPath <Control-a> {save 1}
        menuContextHelp::set $global::fileMenuContextHelper [incr index(file)] $::menuHelp(file,saveAs)
        $menu.file entryconfigure $index(file) -compound left -image $::toolBarImage(saveAs)
        if {($loadedUserModules == 0) && !$databaseMode} {
            $menu.file entryconfigure $index(file) -state disabled
        }
    }

    foreach {string underline} [underlineAmpersand [mc &Modules]] {}
    $menu.file add cascade -label $string -menu [menu $menu.file.modules -tearoff 0] -underline $underline
    menuContextHelp::set $global::fileMenuContextHelper [incr index(file)] [mc {operations on modules}]
    if {![info exists help(modules)]} {
        set help(modules) [new menuContextHelp $menu.file.modules]
    }
    set index(modules) -1
    set disable 1
    if {!$databaseMode} {                                  ;# disallow managing instance module and loading modules in database mode
        if {$global::readOnly} {
            if {[llength $moduleNames] > 0} {
                set disable 0
                foreach {string underline} [underlineAmpersand [mc Loa&ded]] {}
                $menu.file.modules add command -label $string... -command {new moduleOperations display} -underline $underline
                menuContextHelp::set $help(modules) [incr index(modules)] [mc {view loaded modules and their options}]
            }
        } else {
            set disable 0
            foreach {string underline} [underlineAmpersand [mc &Load]] {}
            $menu.file.modules add command -label $string... -command {new moduleOperations load} -underline $underline
            menuContextHelp::set $help(modules) [incr index(modules)] [mc {load new module instances}]
            if {[llength $moduleNames] > 0} {
                foreach {string underline} [underlineAmpersand [mc &Manage]] {}
                $menu.file.modules add command -label $string... -command {new moduleOperations manage} -underline $underline
                menuContextHelp::set $help(modules) [incr index(modules)] [mc {unload, reconfigure modules or create new instances}]
            }
        }
    }
    if {$disable} {
        $menu.file entryconfigure $index(file) -state disabled
    }

    if {!$global::readOnly} {
        foreach {string underline} [underlineAmpersand [mc &Database]] {}
        $menu.file add cascade -label $string -menu [menu $menu.file.database -tearoff 0] -underline $underline
        set global::fileDatabaseMenu $menu.file.database
        menuContextHelp::set $global::fileMenuContextHelper [incr index(file)] [mc {operations on database}]
        if {![info exists help(database)]} {
            set help(database) [new menuContextHelp $menu.file.database]
        }
        set index(database) -1
        foreach {string underline} [underlineAmpersand [mc &Load]] {}
        $menu.file.database add command -label $string... -command "loadFromDatabase [expr {!$global::readOnly}] $global::static"\
            -underline $underline
        menuContextHelp::set $help(database) [incr index(database)] $::menuHelp(file,database,load)
        if {($loadedUserModules == 0) && $databaseMode} {
            $menu.file.database entryconfigure $index(database) -compound left -image $::toolBarImage(playing)
        } else {
            $menu.file.database entryconfigure $index(database) -compound left -image $::toolBarImage(play)
        }
        if {!$databaseMode && ($loadedUserModules > 0)} {
            foreach {string underline} [underlineAmpersand [mc &Record]] {}
            $menu.file.database add command -label $string -command {databaseRecording 1} -underline $underline
            menuContextHelp::set $help(database) [incr index(database)] $::menuHelp(file,database,record)
            $menu.file.database entryconfigure $index(database) -compound left -image $::toolBarImage(record)
            set global::fileDatabaseMenuStartIndex $index(database)
            if {($global::database != 0) || !$anyRecordableCells} {   ;# connected to database: currently storing data cells history
                $menu.file.database entryconfigure $index(database) -state disabled
            }
            foreach {string underline} [underlineAmpersand [mc &Stop]] {}
            $menu.file.database add command -label $string -command {databaseRecording 0} -underline $underline
            menuContextHelp::set $help(database) [incr index(database)] $::menuHelp(file,database,stop)
            if {$global::database == 0} {
                $menu.file.database entryconfigure $index(database) -compound left -image $::toolBarImage(stop)
            } else {                                                  ;# connected to database: currently storing data cells history
                $menu.file.database entryconfigure $index(database) -compound left -image $::toolBarImage(recording)
            }
            if {$global::database == 0} {                              ;# disconnected from database: not storing data cells history
                $menu.file.database entryconfigure $index(database) -state disabled
            }
        }
    }

    foreach {string underline} [underlineAmpersand [mc P&eer]] {}                                                       ;# peer menu
    $menu.file add cascade -label $string -menu [menu $menu.file.peer -tearoff 0] -underline $underline
    menuContextHelp::set $global::fileMenuContextHelper [incr index(file)] [mc {distributed monitoring setup}]
    if {![info exists help(peer)]} {
        set help(peer) [new menuContextHelp $menu.file.peer]
    }
    set index(peer) -1
    foreach {string underline} [underlineAmpersand [mc &Export]] {}
    $menu.file.peer add command -label $string... -underline $underline -command "createNewPeerViewer 1 1 $global::static"
    menuContextHelp::set $help(peer) [incr index(peer)] [mc {create a table exporting data cells}]
    foreach {string underline} [underlineAmpersand [mc &Import]] {}
    $menu.file.peer add command -label $string... -underline $underline -command "createNewPeerViewer 0 1 $global::static"
    menuContextHelp::set $help(peer) [incr index(peer)] [mc {create a table importing data cells}]
    if {$global::readOnly || $databaseMode} {
        $menu.file entryconfigure $index(file) -state disabled
    }

    foreach {string underline} [underlineAmpersand [mc &Print]] {}
    $menu.file add command -label $string... -command $global::printDialogCommand -underline $underline -accelerator Ctrl+P
    menuContextHelp::set $global::fileMenuContextHelper [incr index(file)] $::menuHelp(file,print)
    $menu.file entryconfigure $index(file) -compound left -image $::toolBarImage(print)
    bind $parentPath <Control-p> {}                                         ;# first reset binding which may be optionally set below
    if {($::tcl_platform(platform) eq "unix") || ![catch {package require Tkprint 1.1}]} {
        bind $parentPath <Control-p> $global::printDialogCommand
    } else {
        $menu.file entryconfigure $index(file) -state disabled
    }
    $menu.file add separator
    incr index(file)
    foreach {string underline} [underlineAmpersand [mc &Quit]] {}
    $menu.file add command -label $string -command exit -underline $underline -accelerator Ctrl+Q
    menuContextHelp::set $global::fileMenuContextHelper [incr index(file)] $::menuHelp(file,exit)
    $menu.file entryconfigure $index(file) -compound left -image $::toolBarImage(exit)
    bind $parentPath <Control-q> exit

    if {!$global::readOnly} {
        foreach {string underline} [underlineAmpersand [mc &Edit]] {}
        $menu add cascade -label $string -menu [menu $menu.edit -tearoff 0] -underline $underline
        set index(edit) -1
        if {![info exists help(edit)]} {
            set help(edit) [new menuContextHelp $menu.edit]
        }
        menuContextHelp::set $help(bar) [incr index(bar)] [mc {content editing, configuration and preferences}]

        foreach {string underline} [underlineAmpersand [mc &Thresholds]] {}
        $menu.edit add command -label $string... -command {thresholds::edit} -underline $underline
        menuContextHelp::set $help(edit) [incr index(edit)] [mc {edit data thresholds}]
        if {$databaseMode || ($loadedUserModules == 0)} {
            $menu.edit entryconfigure $index(edit) -state disabled
        } else {
            $menu.edit entryconfigure $index(edit) -state normal
        }
        foreach {string underline} [underlineAmpersand [mc {P&age thresholds}]] {}
        $menu.edit add command -label $string... -command {thresholds::edit [pages::current]} -underline $underline
        menuContextHelp::set $help(edit) [incr index(edit)] [mc {edit data thresholds defined in current page}]
        if {$databaseMode || ($loadedUserModules == 0)} {
            $menu.edit entryconfigure $index(edit) -state disabled
        } else {
            $menu.edit entryconfigure $index(edit) -state normal
        }

        foreach {string underline} [underlineAmpersand [mc &Configuration]] {}
        $menu.edit add command -label $string... -command {configuration::edit 0} -underline $underline
        menuContextHelp::set $help(edit) [incr index(edit)] $::menuHelp(edit,configuration)
        $menu.edit entryconfigure $index(edit) -compound left -image $::toolBarImage(configuration)

        foreach {string underline} [underlineAmpersand [mc {New &page}]] {}
        $menu.edit add command -label $string... -underline $underline -command createNewPage
        menuContextHelp::set $help(edit) [incr index(edit)] [mc {create a new page}]

        foreach {string underline} [underlineAmpersand [mc {New &viewer}]] {}
        $menu.edit add cascade -label $string -menu [menu $menu.edit.new -tearoff 0] -underline $underline
        if {![info exists help(new)]} {
            set help(new) [new menuContextHelp $menu.edit.new]
        }
        menuContextHelp::set $help(edit) [incr index(edit)] [mc {create empty data viewers}]
        if {($loadedUserModules == 0) && !$databaseMode} {
            $menu.edit entryconfigure $index(edit) -state disabled
        }

        foreach {string underline} [underlineAmpersand $::menuLabel(edit,newViewer,::dataGraph)] {}
        $menu.edit.new add command -label $string... -underline $underline -command {createNewCellsViewer ::dataGraph}
        menuContextHelp::set $help(new) 0 [mc {create an empty graph chart data viewer}]

        foreach {string underline} [underlineAmpersand $::menuLabel(edit,newViewer,::dataStackedGraph)] {}
        $menu.edit.new add command -label $string... -underline $underline -command {createNewCellsViewer ::dataStackedGraph}
        menuContextHelp::set $help(new) 1 [mc {create an empty stacked graph chart data viewer}]

        foreach {string underline} [underlineAmpersand $::menuLabel(edit,newViewer,::dataOverlapBarChart)] {}
        $menu.edit.new add command -label $string... -underline $underline -command {createNewCellsViewer ::dataOverlapBarChart}
        menuContextHelp::set $help(new) 2 [mc {create an empty overlap bar chart data viewer}]

        foreach {string underline} [underlineAmpersand $::menuLabel(edit,newViewer,::dataSideBarChart)] {}
        $menu.edit.new add command -label $string... -underline $underline -command {createNewCellsViewer ::dataSideBarChart}
        menuContextHelp::set $help(new) 3 [mc {create an empty side bar chart data viewer}]

        foreach {string underline} [underlineAmpersand $::menuLabel(edit,newViewer,::dataStackedBarChart)] {}
        $menu.edit.new add command -label $string... -underline $underline -command {createNewCellsViewer ::dataStackedBarChart}
        menuContextHelp::set $help(new) 4 [mc {create an empty stacked bar chart data viewer}]

        foreach {string underline} [underlineAmpersand $::menuLabel(edit,newViewer,::data2DPieChart)] {}
        $menu.edit.new add command -label $string... -underline $underline -command {createNewCellsViewer ::data2DPieChart}
        menuContextHelp::set $help(new) 5 [mc {create an empty 2D pie chart data viewer}]

        foreach {string underline} [underlineAmpersand $::menuLabel(edit,newViewer,::data3DPieChart)] {}
        $menu.edit.new add command -label $string... -underline $underline -command {createNewCellsViewer ::data3DPieChart}
        menuContextHelp::set $help(new) 6 [mc {create an empty 3D pie chart data viewer}]

        foreach {string underline} [underlineAmpersand $::menuLabel(edit,newViewer,::currentValueTable)] {}
        $menu.edit.new add command -label $string... -underline $underline -command {createNewCellsViewer ::currentValueTable}
        menuContextHelp::set $help(new) 7 [mc {create an empty values table data viewer}]

        foreach {string underline} [underlineAmpersand $::menuLabel(edit,newViewer,::summaryTable)] {}
        $menu.edit.new add command -label $string... -underline $underline -command {createNewCellsViewer ::summaryTable}
        menuContextHelp::set $help(new) 8 [mc {create an empty statistics table data viewer}]

        foreach {string underline} [underlineAmpersand $::menuLabel(edit,newViewer,::freeText)] {}
        $menu.edit.new add command -label $string... -underline $underline -command {createNewCellsViewer ::freeText}
        menuContextHelp::set $help(new) 9 [mc {create an empty free text data viewer}]

        foreach {string underline} [underlineAmpersand $::menuLabel(edit,newViewer,::canvas::iconic)] {}
        $menu.edit.new add command -label $string... -underline $underline -command {createNewCellsViewer ::canvas::iconic}
        menuContextHelp::set $help(new) 10 [mc {create an iconic data viewer with no associated data cell}]

        foreach {string underline} [underlineAmpersand $::menuLabel(edit,newViewer,::formulas::table)] {}
        $menu.edit.new add command -label $string... -underline $underline -command formulasDialog
        menuContextHelp::set $help(new) 11 [mc {create an empty formulas table data viewer}]

        foreach {string underline} [underlineAmpersand [mc &Database]] {}
        $menu.edit add command -label $string... -underline $underline
        menuContextHelp::set $help(edit) [incr index(edit)] [mc {select cells to archive in database}]
        if {$databaseMode || ($loadedUserModules == 0)} {
            $menu.edit entryconfigure $index(edit) -state disabled
        } else {
            $menu.edit entryconfigure $index(edit) -state normal
            if {$global::database == 0} {                              ;# disconnected from database: not storing data cells history
                $menu.edit entryconfigure $index(edit) -command {updateDatabaseStart disabled; store::edit 1 updateDatabaseStart}
            } elseif {$loadedUserModules > 0} {                                              ;# currently storing data cells history
                $menu.edit entryconfigure $index(edit) -command {store::edit 0 {}}               ;# only display archived data cells
            }
        }

        $menu.edit add separator
        incr index(edit)
        foreach {string underline} [underlineAmpersand [mc P&references]] {}
        $menu.edit add command -label $string... -command {configuration::edit 1} -underline $underline
        menuContextHelp::set $help(edit) [incr index(edit)] [mc {edit application-wide preferences}]
    }

    if {($::tcl_platform(platform) eq "unix") && !$global::readOnly} {
        foreach {string underline} [underlineAmpersand [mc &Tools]] {}
        $menu add cascade -label $string -menu [menu $menu.tools -tearoff 0] -underline $underline
        if {![info exists help(tools)]} {
            set help(tools) [new menuContextHelp $menu.tools]
        }
        menuContextHelp::set $help(bar) [incr index(bar)] [mc {miscellaneous utilities}]

        foreach {string underline} [underlineAmpersand $::menuLabel(edit,newViewer,::predictor)] {}
        $menu.tools add command -label $string... -underline $underline -command {createNewCellsViewer ::predictor}
        menuContextHelp::set $help(tools) 0 [mc {create an empty predictor data viewer}]
        if {$databaseMode} {
            $menu.tools entryconfigure 0 -state normal
        } else {
            $menu.tools entryconfigure 0 -state disabled
        }
    }

    foreach {string underline} [underlineAmpersand [mc &View]] {}
    $menu add cascade -label $string -menu [menu $menu.view -tearoff 0] -underline $underline
    if {![info exists help(view)]} {
        set help(view) [new menuContextHelp $menu.view]
    }
    menuContextHelp::set $help(bar) [incr index(bar)] [mc {data visualization settings}]
    set index(view) -1
    bind $parentPath <Control-r> {}                                        ;# first reset bindings which may be optionally set below
    if {!$global::readOnly && ((($loadedUserModules > 0) && $anySynchronousModules) || $databaseMode)} {
        foreach {string underline} [underlineAmpersand [mc &Refresh]] {}
        $menu.view add command -label $string -command {after idle ::refresh} -underline $underline -accelerator Ctrl+R
        bind $parentPath <Control-r> {after idle ::refresh}
        if {$databaseMode} {
            menuContextHelp::set $help(view) [incr index(view)] $::menuHelp(view,refreshDatabase)
        } else {
            menuContextHelp::set $help(view) [incr index(view)] $::menuHelp(view,refresh)
        }
        $menu.view entryconfigure $index(view) -compound left -image $::toolBarImage(refresh)
    }
    if {$databaseMode} {
        foreach {string underline} [underlineAmpersand [mc {&Database range}]] {}
        $menu.view add command -label $string... -command database::displayAndSelectRange -underline $underline
        menuContextHelp::set $help(view) [incr index(view)] [mc {select time range for database history views}]
    }
    if {$loadedUserModules > 0} {                                            ;# only useful when there is at least one loaded module
        if {!$global::readOnly && $anySynchronousModules} {
            foreach {string underline} [underlineAmpersand [mc {&Poll time}]] {}
            $menu.view add command -label $string... -command inquirePollTime -underline $underline
            menuContextHelp::set $help(view) [incr index(view)] [mc {change poll time for all synchronous modules}]
        }
    }
    foreach {string underline} [underlineAmpersand [mc &Objects]] {}
    set global::viewObjectsMenu [menu $menu.view.objects -tearoff 0]
    set global::viewObjectsMenuIndex [incr index(view)]
    $menu.view add cascade -label $string -menu $global::viewObjectsMenu -underline $underline
    menuContextHelp::set $help(view) $global::viewObjectsMenuIndex [mc {find and bring to front a table or a viewer}]
    updateViewObjectsMenu
    foreach {string underline} [underlineAmpersand [mc &Trace]] {}
    $menu.view add checkbutton -label $string -command {residentTraceModule $global::showTrace} -underline $underline\
        -variable global::showTrace -offvalue 0 -onvalue 1
    menuContextHelp::set $help(view) [incr index(view)] [mc {show or hide loaded modules informational, error, ... messages}]
    foreach {string underline} [underlineAmpersand [mc {Tool &bar}]] {}
    $menu.view add checkbutton -label $string\
        -command manageToolBar -underline $underline -variable global::showToolBar -offvalue 0 -onvalue 1
    menuContextHelp::set $help(view) [incr index(view)] [mc {show or hide the tool bar}]

    if {$::tcl_platform(platform) eq "windows"} {
        set string ?
        set underline 0
    } else {
        foreach {string underline} [underlineAmpersand [mc &Help]] {}
    }
    $menu add cascade -label $string -menu [menu $menu._help -tearoff 0] -underline $underline
    if {![info exists help(help)]} {
        set help(help) [new menuContextHelp $menu._help]                  ;# do not use help name which would right justify the menu
    }
    set index(help) -1
    menuContextHelp::set $help(bar) [incr index(bar)] [mc {help on moodss and modules}]

    foreach {string underline} [underlineAmpersand [mc &Global]] {}
    $menu._help add command -label $string... -underline 0 -accelerator F1 -command generalHelpWindow
    bind $parentPath <F1> generalHelpWindow
    menuContextHelp::set $help(help) [incr index(help)] $::menuHelp(help,global)
    $menu._help entryconfigure $index(help) -compound left -image $::toolBarImage(help)

    if {([llength $moduleNames] > 0) && !$databaseMode} {
        # display modules help menu only if they are any loaded and not in database mode (instance module help not available)
        foreach {string underline} [underlineAmpersand [mc &Modules]] {}
        $menu._help add cascade -label $string -menu [menu $menu._help.modules -tearoff 0] -underline $underline
        menuContextHelp::set $help(help) [incr index(help)] [mc {help on loaded modules}]
        if {![info exists help(modulesHelp)]} {
            set help(modulesHelp) [new menuContextHelp $menu._help.modules]
        }
        set index(modulesHelp) -1
        foreach module $moduleNames {
            $menu._help.modules add command -label $module... -command "moduleHelpWindow $module \[modules::helpHTMLData $module\]"
            menuContextHelp::set $help(modulesHelp) [incr index(modulesHelp)]\
                [format [mc {display %s module documentation}] $module]
        }
    }

    foreach {string underline} [underlineAmpersand [mc &About]] {}
    $menu._help add command -label $string... -underline $underline -command aboutDialogBox
    menuContextHelp::set $help(help) [incr index(help)] [mc {display authors and general information}]
    $menu._help entryconfigure $index(help) -compound left -image [image create photo -data {
        R0lGODlhFgAWAOfyAAADlAcPSgAAsAAAsQsDhwgJcQAAuQAOcQAHmAAEqgIAugAGoQMCswANgQAJmgALkgQGqwgDtAwAvBYAoRUHjBIRYhgFlBEBvQAJxRkM
        hg4OnhULrxMYfRwbWRUWjB4IwgkXtA0UxBsbgSMdaRwinQwjxBEkxSElmRcmwCQgviwniCcrkSgnqx8srSsiySAoyzM1UjAovicuwCoyrjc6YjIzxzM5rjk3
        y0JBgz9Bt0E+y0JAxkxNbERBx0pHpEdEw0xHq0dGvkhFxUJH00NI1EhM0k9MxVxaXVVVk0tO1ExP1VxXkE9R11dQ0ldSzFthkVZZ2V9Z1Fpd1mZlt2hi13Jw
        dG9vhGxwimVo3GVq1mZp3XJyk3V2f3Z2i3p4fGpv3G1x3n15im91x3Vy23uAg3Zz3Hd03YF9mn2BkHJ434OBhXV64YCEk3t63IWHhIaIhX183oSJjIeJhoWK
        jX9+4H+A24mLiIeMj4qMiYGC3ouNio2Ol46QjYmJxIaH45KQlJORlZGTkI6SoY+PsZSSlpKUkY6J4IiM4ZGWmJaUmJCQv4qO45aYlYuP5JaXoZeZloyQ5ZGQ
        4JqbmJyanpaWxZ2bn5aX05aU5J6gnZiW5p+hnp+fqZuY3Jia46GjoJmb5KShpqKkoZqc5Zud5qSmo5ye56CkwKWnpKOixZ2f6KKmtaOf5Keppqiqp6mrqKmq
        tKqsqautqqap0qKn6a2qu6eq062vrKSp67Cyrquq6LGzr7Gxu6yr6bK0sbS2s7W3tLGx77e5trm7uLK17Lq8ubO37bu9uri+wLS47r7BvcDCvr3B0L297sDA
        17++78C/8MLB88XE3MXB7cDE7sfC7sLF78bF6sXJ2cPG8MXI8srK4c3N5c3M8c/O887S79XQ79LR9tTU69fS8djT89nX29fX79nZ5Nva8tfb+N3e6N3d9OXi
        5uLi+ufk6erm+Ovp7fLz/fb0+P///////////////////////////////////////////////////////yH5BAEKAP8ALAAAAAAWABYAAAj+AP8JtCXwX6+C
        BYMVJIZQIKiCD/8Jg1hwV8N/oQryUXbsj0BG6+K9I/foosV/ZNrBc6dOkJp07rx1O2cOIZ5CoeL8iQYN2Spg3sI9K3XoUK5vr/DogTjpG7BLZuDkOgdtlJkc
        PeA8W3Zx2TRIUogYAletlBkgHXLcgqaoICtEu6xdwhLjh7dsmcwYQWIFlbhVU96wEjjJW64xO0b0kTZrjBIbiPagA9YGCMJoxeD8aFFFFtQhKP5JusbskBOE
        quRKkfGPliUwTkxQ+AfKmigsMwoSQpUpSw0VmAZlUeJiAA5NqGaB0XHCkStX/yytIQJC4JkfJjAAEEipThEXHBCXimniIoPAOScGLCgYKUqMDUcKSloyQ0UY
        gb7IPGEDnceXGxh4oAtCXnSxxxx4EHIKHnL8ogYeNBDxgQIZXMGFHHgUlJFDF5lwgQICAFBAQxH9E8tFGkQAwQQLWHDAP7awYkuMrMCiyyms5NjKKVs8kMAC
        DjzAARoUcdiQJv9U0EAGBQSA0Ib/QNcQlDBcVGKJRf5zSkEBAQA7
    }]
    $parentPath configure -menu $menu
}

proc updateFileSaveHelp {file} {
    if {![info exists global::fileMenuContextHelperSaveIndex]} return                                  ;# file save menu not visible
    if {$file eq ""} {
        set string $::menuHelp(file,saveAs)
    } else {
        set string [format [mc {into %s file, save dashboard configuration}] $file]
    }
    menuContextHelp::set $global::fileMenuContextHelper $global::fileMenuContextHelperSaveIndex $string
    switched::configure $global::fileSaveHelpTip -text $string
}

proc createMessageWidget {parentPath} {
    # make sure eventual initial messages are visible by presetting width:
    set frame [frame $parentPath.messenger -borderwidth $widget::option(button,borderwidth) -relief sunken]
    # place thresholds label in message area as header in upper left corner so that multi-line messages look good
    set label [new thresholdLabel $frame -text [mc Message:]]
    grid $widget::($label,path) -row 0 -column 0 -sticky nw -ipadx 1
    set global::messenger [new lifoLabel $frame -font $font::(mediumNormal) -borderwidth 0]
    composite::configure $global::messenger base -width 300                       ;# make sure eventual initial messages are visible
    grid $widget::($global::messenger,path) -row 0 -column 1 -sticky nsew
    grid columnconfigure $frame 1 -weight 1
    return $frame
}

proc updateDragAndDropZone {{parentPath .}} {
    static drop
    static cache

    set databaseMode [lindex [userInputStates] 3]
    if {[info exists cache] && ($cache(databaseMode) eq $databaseMode)} return              ;# avoid updates when there is no change
    set cache(databaseMode) $databaseMode            ;# the drag'n'drop zone configuration is uniquely determined from this variable

    set frame .[string trimleft $parentPath.drops .]                                 ;# remove double dot when parent is main widget
    if {![info exists drop]} {
        frame $frame

        set label [label $frame.graph -image applicationIcon -relief sunken]
        pack $label -pady 1 -side left
        new dropSite -path $label -formats DATACELLS -command {createNewCellsViewer ::dataGraph $dragSite::data(DATACELLS)}
        new widgetTip -path $label -text [mc {graph chart drag'n'drop site}]
        set drag [new dragSite -path $label]
        dragSite::provide $drag VIEWER {dragEcho ::dataGraph}

        set label [label $frame.stackedGraph -image [image create photo -data [dataStackedGraph::iconData]] -relief sunken]
        pack $label -pady 1 -side left
        new dropSite -path $label -formats DATACELLS -command {createNewCellsViewer ::dataStackedGraph $dragSite::data(DATACELLS)}
        new widgetTip -path $label -text [mc {stacked graph chart drag'n'drop site}]
        set drag [new dragSite -path $label]
        dragSite::provide $drag VIEWER {dragEcho ::dataStackedGraph}

        set label [label $frame.overlapBarChart -image [image create photo -data [dataOverlapBarChart::iconData]] -relief sunken]
        pack $label -pady 1 -side left
        new dropSite -path $label -formats DATACELLS\
            -command {createNewCellsViewer ::dataOverlapBarChart $dragSite::data(DATACELLS)}
        new widgetTip -path $label -text [mc {overlap bar chart drag'n'drop site}]
        set drag [new dragSite -path $label]
        dragSite::provide $drag VIEWER {dragEcho ::dataOverlapBarChart}

        set label [label $frame.sideBarChart -image [image create photo -data [dataSideBarChart::iconData]] -relief sunken]
        pack $label -pady 1 -side left
        new dropSite -path $label -formats DATACELLS -command {createNewCellsViewer ::dataSideBarChart $dragSite::data(DATACELLS)}
        new widgetTip -path $label -text [mc {side bar chart drag'n'drop site}]
        set drag [new dragSite -path $label]
        dragSite::provide $drag VIEWER {dragEcho ::dataSideBarChart}

        set label [label $frame.stackedBarChart -image [image create photo -data [dataStackedBarChart::iconData]] -relief sunken]
        pack $label -pady 1 -side left
        new dropSite -path $label -formats DATACELLS\
            -command {createNewCellsViewer ::dataStackedBarChart $dragSite::data(DATACELLS)}
        new widgetTip -path $label -text [mc {stacked bar chart drag'n'drop site}]
        set drag [new dragSite -path $label]
        dragSite::provide $drag VIEWER {dragEcho ::dataStackedBarChart}

        set label [label $frame.2DPieChart -image [image create photo -data [data2DPieChart::iconData]] -relief sunken]
        pack $label -pady 1 -side left
        new dropSite -path $label -formats DATACELLS -command {createNewCellsViewer ::data2DPieChart $dragSite::data(DATACELLS)}
        new widgetTip -path $label -text [mc {2D pie chart drag'n'drop site}]
        set drag [new dragSite -path $label]
        dragSite::provide $drag VIEWER {dragEcho ::data2DPieChart}

        set label [label $frame.3DPieChart -image [image create photo -data [data3DPieChart::iconData]] -relief sunken]
        pack $label -pady 1 -side left
        new dropSite -path $label -formats DATACELLS -command {createNewCellsViewer ::data3DPieChart $dragSite::data(DATACELLS)}
        new widgetTip -path $label -text [mc {3D pie chart drag'n'drop site}]
        set drag [new dragSite -path $label]
        dragSite::provide $drag VIEWER {dragEcho ::data3DPieChart}

        set label [label $frame.currentValueTable -image [image create photo -data [currentValueTable::iconData]] -relief sunken]
        pack $label -pady 1 -side left
        new dropSite -path $label -formats DATACELLS -command {createNewCellsViewer ::currentValueTable $dragSite::data(DATACELLS)}
        new widgetTip -path $label -text [mc {values table drag'n'drop site}]
        set drag [new dragSite -path $label]
        dragSite::provide $drag VIEWER {dragEcho ::currentValueTable}

        set label [label $frame.summaryTable -image [image create photo -data [summaryTable::iconData]] -relief sunken]
        pack $label -pady 1 -side left
        new dropSite -path $label -formats DATACELLS -command {createNewCellsViewer ::summaryTable $dragSite::data(DATACELLS)}
        new widgetTip -path $label -text [mc {statistics table drag'n'drop site}]
        set drag [new dragSite -path $label]
        dragSite::provide $drag VIEWER {dragEcho ::summaryTable}

        set label [label $frame.freeText -image [image create photo -data [freeText::iconData]] -relief sunken]
        pack $label -pady 1 -side left
        new dropSite -path $label -formats DATACELLS -command {createNewCellsViewer ::freeText $dragSite::data(DATACELLS)}
        new widgetTip -path $label -text [mc {free text drag'n'drop site}]
        set drag [new dragSite -path $label]
        dragSite::provide $drag VIEWER {dragEcho ::freeText}

        set label [label $frame.icon -image [image create photo -data [canvas::iconic::iconData]] -relief sunken]
        pack $label -pady 1 -side left
        new dropSite -path $label -formats DATACELLS -command {createNewCellsViewer ::canvas::iconic $dragSite::data(DATACELLS)}
        new widgetTip -path $label -text [mc {iconic data viewer drag'n'drop site}]
        set drag [new dragSite -path $label]
        dragSite::provide $drag VIEWER {dragEcho ::canvas::iconic}

        set label [label $frame.threshold -image [image create photo -data [thresholds::iconData]] -relief sunken]
        pack $label -pady 1 -side left
        set drop(thresholds,label) $label
        set drop(thresholds,site) [new dropSite\
            -path $label -formats DATACELLS\
            -command {thresholds::edit; viewer::view $thresholds::singleton $dragSite::data(DATACELLS)}\
        ]
        new widgetTip -path $label -text [mc {threshold drop site}]

        set eraserData {
            R0lGODdhJAAkAKUAAPj4+Hh4eLi4uMiAKLhQAPDouPDksOjYoOjQmOjMkODAgOC8eNiwaPj8+Ojw6ODg4NjY2MDIwNioYNikWLCwsNCYSFCQqJigmJCQkNCQ
            QODo6NDg6Mjg4IiIiAAAAHB4cMiIMGhoaMDY2MjY4GBgYMh8IEhQSLDQ2EBAQKjI0LjQ2Dg4OCAoIKDAyJC4yIi4wICAgHiwuKDI0IiQiJjAyJCYkJiYmKCg
            oKioqICwwMDAwMjQyNDY0HiouOjo6AAAACwAAAAAJAAkAAAG/kCAcCgMEI/G4zBZVBKZSijy6VxWAVKqFRvoer9dwZULBlfF1cGAwJ5ux0p1wWA4HNrNN3xI
            KMzrBwgICQR5eV5oVX10doIJCQoKhWRfewAEX46QCgsLDAQNWnsBDg8PEBBdm50Mn25wpKaoERECAawMEhITk4cBiU+yELQCAhQUAbm7ExWFZVcW0dG1xhQX
            FxgBE8wVGb1YYxYaG+Qc0cfXGBgdHhXd3qJK4uQb5hoaFtjrHR8eGRkgQHxL8kWMhXIc7I3bYKEDvw8hQngAocaDh2dEDibkIOIgvREjLEAMQYKEhwElCFzU
            I8RCQhEwPZIDCdICSRImPKS8+MtQ/kuYIk6ckEmzpgWcJlB4UInIl4WgQlMcLApSRTRzKFCssMjVohkLUVNIpaqi7NWQK1aw4BlmC1ixKVpYoFlWhdCzVtWy
            7blFbIu/c0fUFTo0sF0Lawu6+evChYXBhAsLLju0q+XLjV88jhw1GuW7e8uAeaGZM9xohMVa2AujtevXrWOADZtChgzUcOXuncG7t+/es+HaphEtt+4vNZIr
            X75c+HDiFuL+Jb7Xxo3r2LNnty2DhnfHFqZ7X/3FBo7z6NOr906jMXj2jcl7sVGsvv37xdzHt9C+cQ75Xdigw4AEFmjggO79Z0GC/1W3w4MQRighhC7koGCF
            FspWHQ8cJ3bo4Yce5iCbBRnGoGF5pqSo4oosjmhiDD30AGAANvhg44045qhjEAA7
        }
        set label [label $frame.eraser -image [image create photo -data $eraserData] -relief sunken]
        pack $label -pady 1 -side left
        new dropSite -path $label -formats OBJECTS -command "eval delete \$dragSite::data(OBJECTS); updateViewObjectsMenu"
        new widgetTip -path $label -text [mc {objects deletion drag'n'drop site}]
        set drag [new dragSite -path $label]
        dragSite::provide $drag KILL list                                       ;# drag data is unimportant, only the kill action is
    }
    if {$databaseMode} {
        $drop(thresholds,label) configure -state disabled
        switched::configure $drop(thresholds,site) -state disabled
    } else {
        $drop(thresholds,label) configure -state normal
        switched::configure $drop(thresholds,site) -state normal
    }
    return $frame
}

proc inquirePollTime {} {
    set dialog [new dialogBox .grabber\
        -buttons hoc -default o -title [mc {moodss: Poll time}] -die 0 -x [winfo pointerx .] -y [winfo pointery .]\
        -helpcommand {generalHelpWindow #menus.view.polltime} -deletecommand {grab release .grabber}\
    ]
    grab .grabber                                                          ;# grab siblings such as help window so that it is usable
    lappend objects [linkedHelpWidgetTip $composite::($dialog,help,path)]
    set frame [frame $widget::($dialog,path).frame]
    set minimum [lindex $global::pollTimes 0]
    set message [message $frame.message\
        -width [winfo screenwidth .] -font $font::(mediumNormal) -justify center\
        -text [format [mc {Enter new poll time (greater than %u):}] $minimum]\
    ]
    pack $message
    set entry [spinbox $frame.spinbox -font $font::(mediumBold) -width 5 -values $global::pollTimes]
    $entry set $global::pollTime
    setupEntryValidation $entry {{check31BitUnsignedInteger %P}}                                  ;# filter on positive integers
    pack $entry -anchor e -side left -expand 1 -padx 2                   ;# evenly pack entry and label together near the center
    pack [label $frame.label -text [mc seconds]] -anchor w -side right -expand 1 -padx 2
    dialogBox::display $dialog $frame
    widget::configure $dialog -command "
        set time \[$entry get\]
        if {\$time < $minimum} {                                                                  ;# check against minimum poll time
            bell
            $message configure -text \[format \[mc {Enter new poll time\n(must be greater than %u):}\] $minimum\]
        } else {                                                                                                ;# new time is valid
            if {\$time != \$global::pollTime} {                                   ;# but check that it actually differs from current
                set global::pollTime \$time
                viewer::updateInterval \$time
                updateTitle
                refresh                                      ;# update immediately in case poll time was set to a much greater value
            }
            delete $dialog                                                                                     ;# destroy dialog box
        }
    "
    bind $frame <Destroy> "delete $objects"                                          ;# delete objects not managed by the dialog box
}

proc updateToolBar {{parentPath .}} {
    static button
    static icon
    static tip
    static cache

    initializeMenuHelp
    set frame .[string trimleft $parentPath.tools .]                                 ;# remove double dot when parent is main widget
    if {![info exists button]} {                                                                          ;# create all widgets once
        set dark [lindex [3DBorders . $widget::option(menu,background)] 0]
        frame $frame
        set widget [new imageButton $frame -image $::toolBarImage(new) -command clear]
        new widgetTip -path $widget::($widget,path) -text $::menuHelp(file,new)
        set button(new) $widget
        set widget [new imageButton $frame -image $::toolBarImage(open) -command reload]
        new widgetTip -path $widget::($widget,path) -text $::menuHelp(file,open)
        set button(open) $widget
        set widget [new imageButton $frame -image $::toolBarImage(save) -command {save 0}]
        set global::fileSaveHelpTip [new widgetTip -path $widget::($widget,path)]
        set button(save) $widget
        set widget [new imageButton $frame -image $::toolBarImage(saveAs) -command {save 1}]
        new widgetTip -path $widget::($widget,path) -text $::menuHelp(file,saveAs)
        set button(saveAs) $widget
        set widget [new imageButton $frame -image $::toolBarImage(print) -command $global::printDialogCommand]
        new widgetTip -path $widget::($widget,path) -text $::menuHelp(file,print)
        set button(print) $widget
        set widget [new imageButton $frame -image $::toolBarImage(configuration) -command {configuration::edit 0}]
        new widgetTip -path $widget::($widget,path) -text $::menuHelp(edit,configuration)
        set button(configuration) $widget
        set widget [new imageButton $frame -image $::toolBarImage(refresh) -command {after idle ::refresh}]
        set tip(refresh) [new widgetTip -path $widget::($widget,path)]
        set button(refresh) $widget
        set widget [new imageButton $frame -image $::toolBarImage(help) -command generalHelpWindow]
        new widgetTip -path $widget::($widget,path) -text $::menuHelp(help,global)
        set button(help) $widget
        set widget [new imageButton $frame -image $::toolBarImage(exit) -command exit]
        new widgetTip -path $widget::($widget,path) -text $::menuHelp(file,exit)
        set button(exit) $widget
        set widget [new imageButton $frame -image $::toolBarImage(record) -command {databaseRecording 1}]
        set global::fileDatabaseStartButtonTip\
            [new widgetTip -path $widget::($widget,path) -text $::menuHelp(file,database,record,disabled)]
        set button(record) $widget
        set global::fileDatabaseStartButton $button(record)
        frame $frame.recordSeparator -bg $dark -width 1                                                    ;# thin vertical darkline
        set widget [new imageButton $frame -image $::toolBarImage(recording) -command {databaseRecording 0}]
        new widgetTip -path $widget::($widget,path) -text $::menuHelp(file,database,stop)
        set button(recording) $widget
        set widget [new imageButton $frame -image $::toolBarImage(stop) -command {databaseRecording 0}]
        new widgetTip -path $widget::($widget,path) -text $::menuHelp(file,database,stop)
        set button(stop) $widget
        # use file database load menu command:
        set widget [new imageButton $frame\
            -image $::toolBarImage(play) -command "loadFromDatabase [expr {!$global::readOnly}] $global::static"\
        ]
        new widgetTip -path $widget::($widget,path) -text $::menuHelp(file,database,load)
        set button(play) $widget
        frame $frame.playSeparator -bg $dark -width 1                                                      ;# thin vertical darkline
        set widget [new imageButton $frame -image $::toolBarImage(playing) -command [composite::cget $button(play) -command]]
        new widgetTip -path $widget::($widget,path) -text $::menuHelp(file,database,load)
        set button(playing) $widget
        grid columnconfigure $frame 100 -weight 1                                                 ;# so that icons stick to the left
    }
    foreach {loadedUserModules anySynchronousModules databaseConnected databaseMode anyRecordableCells} [userInputStates] {}
    if {[info exists cache]} {
        set change 0
        foreach {name value} [array get cache] {
            if {[set $name] ne $value} {set change 1; break}
        }
        if {!$change} {return $frame}                                                       ;# avoid updates when there is no change
    }
    foreach name {loadedUserModules anySynchronousModules databaseMode databaseConnected anyRecordableCells global::readOnly} {
        set cache($name) [set $name]                       ;# the tool bar configuration is uniquely determined from these variables
    }
    switched::configure $tip(refresh) -text $::menuHelp(view,refresh)
    if {$global::readOnly} {
        if {$databaseMode} {
            set list {print refresh help exit}
            switched::configure $tip(refresh) -text $::menuHelp(view,refreshDatabase)
        } else {
            set list {print help exit}
        }
    } elseif {$loadedUserModules == 0} {
        if {$databaseMode} {
            set list {new open save saveAs print playing configuration refresh help exit}
            switched::configure $tip(refresh) -text $::menuHelp(view,refreshDatabase)
        } else {
            set list {new open save saveAs print play configuration help exit}
            array set disable {save {} saveAs {}}                                                                 ;# behave as menus
        }
    } else {
        set list {new open save saveAs print record}
        if {$global::database == 0} {                                  ;# disconnected from database: not storing data cells history
            if {!$anyRecordableCells} {set disable(record) {}}
            lappend list stop
            set disable(stop) {}
        } else {                                                      ;# connected to database: currently storing data cells history
            lappend list recording
            set disable(record) {}
        }
        lappend list play configuration
        if {$anySynchronousModules} {
            lappend list refresh
        }
        lappend list help exit
    }
    if {($::tcl_platform(platform) eq "windows") && [catch {package require Tkprint 1.1}]} {
        ldelete list print                        ;# do not display print icon when printing is not available on the windows machine
    }
    eval grid forget [winfo children $frame]                                                       ;# first unmap all existing icons
    set column 0
    foreach name $list {
        if {$name eq "record"} {                                                     ;# always insert separator before record button
            grid $frame.recordSeparator -row 0 -sticky ns -column $column
            incr column
        }
        if {[info exists disable($name)]} {set state disabled} else {set state normal}
        composite::configure $button($name) -state $state
        grid $widget::($button($name),path) -row 0 -sticky ns -column $column
        incr column
        if {($name eq "play") && ([llength [grid info $frame.recordSeparator]] > 0)} {
            # always add separator after play button but only if record and stop buttons are displayed
            grid $frame.playSeparator -row 0 -sticky ns -column $column
            incr column
        }
    }
    updateDatabaseStartButtonTip
    return $frame
}

proc updateDatabaseStartButtonTip {} {
    if {[store::anyActiveCells $store::singleton]} {
        switched::configure $global::fileDatabaseStartButtonTip -text $::menuHelp(file,database,record)
    } else {
        switched::configure $global::fileDatabaseStartButtonTip -text $::menuHelp(file,database,record,disabled)
    }
}

proc updateDatabaseStart {{state {}}} {                                               ;# set start database recording controls state
    if {$state eq ""} {
        if {[store::anyActiveCells $store::singleton]} {
            set state normal
        } else {
            set state disabled
        }
        updateDatabaseStartButtonTip
    }
    $global::fileDatabaseMenu entryconfigure $global::fileDatabaseMenuStartIndex -state $state
    composite::configure $global::fileDatabaseStartButton -state $state
}

# return list of booleans:
# any loaded user modules, any loaded synchronous modules, connected to database, database history mode, any recordable cells
proc userInputStates {} {
    # peer module included since it is could be proxying active data, whereas formulas module does nothing if no other module loaded
    set modules [modules::namesWithout formulas]
    set history [llength $modules]                             ;# there must be at least one loaded module to determine history mode
    foreach module $modules {
        if {$module ne "instance"} {
            set history 0                                            ;# in history mode, all loaded modules must be instance modules
            break
        }
    }
    if {$history || [info exists databaseInstances::singleton]} {     ;# history mode (also implied by instances viewer's existence)
        return {0 0 1 1 0}                                                                                       ;# implies the rest
    } else {
        return [list\
            [expr {[llength $modules] > 0}] [expr {[llength $global::pollTimes] > 0}]\
            [expr {$global::database != 0}] 0 [store::anyActiveCells $store::singleton]\
        ]
    }
}

proc createBackgroundMenu {} {
    set menu [new menu $global::canvas -tearoff 0]                                                            ;# note: never deleted
    set path $widget::($menu,path)
    $path add command -label [mc Background]... -command changeBackground
    $path add command -label [mc Thresholds]... -command {thresholds::edit [pages::current]}
    # do not replace popup menus displayed from canvas items (such as iconic viewers menu):
    bind $global::canvas <ButtonPress-3> "if {\$::tk::Priv(popup)\ eq \"\"} {tk_popup $path %X %Y}"
    set help [new menuContextHelp $path]
    menuContextHelp::set $help 0 [mc {change background color or image}]
    menuContextHelp::set $help 1 [mc {edit data thresholds defined in this page}]
    return $menu
}

proc changeBackground {} {
    set page [pages::current]
    if {$page == 0} {                                                                                                    ;# no pages
        set title [mc {moodss: Background}]
        set background $global::canvasBackground
        set file $global::canvasImageFile
        set position $global::canvasImagePosition
    } else {
        set title [mc {moodss: Page background}]
        set background [composite::cget $page -background]
        set file [composite::cget $page -imagefile]
        set position [composite::cget $page -imageposition]
   }
    foreach {left top right bottom} [bounds $global::canvas] {}
    set size [list [expr {$right - $left}] [expr {$bottom - $top}]]
    set dialog [new dialogBox .grabber\
        -buttons hoc -default o -title $title -x [winfo pointerx .] -y [winfo pointery .]\
        -helpcommand {generalHelpWindow #configuration.application.backgrounds}\
    ]
    grab .grabber                                                          ;# grab siblings such as help window so that it is usable
    set ::background$dialog 0                                                                            ;# use unique variable name
    composite::configure $dialog\
        -command "incr ::background$dialog" -deletecommand "grab release .grabber; incr ::background$dialog 0"
    set chooser [new backgroundChooser $widget::($dialog,path)\
        -font $font::(mediumNormal) -color $background -targetsize $size\
        -imagefile $file -useimage [expr {$file ne ""}] -position $position\
    ]
    dialogBox::display $dialog $widget::($chooser,path)
    vwait ::background$dialog                                                                      ;# wait till dialog box is closed
    if {[set ::background$dialog]} {                                                                   ;# user validated its choices
        if {[composite::cget $chooser -useimage]} {
            set file [composite::cget $chooser -imagefile]
        } else {
            set file {}
        }
        set background [composite::cget $chooser -color]
        set position [composite::cget $chooser -position]
        if {$page == 0} {
            $global::canvas configure -background $background
            updateCanvasImage $file
            if {$file ne ""} {
                updateCanvasImagePosition $global::canvasImageItem $position
            }
            set global::canvasBackground $background
            set global::canvasImageFile $file
            set global::canvasImagePosition $position
        } else {
            composite::configure $page -background $background -imagefile $file -imageposition $position
        }
    }                                                                                                          ;# else user canceled
    delete $chooser
}

# invoke only when necessary: for example, wait till all viewers and tables are created, instead of updating at each object creation
proc updateViewObjectsMenu {} {                                                                 ;# note: inspired by record::write{}
    foreach pageMenu [winfo children $global::viewObjectsMenu] {
        destroy $pageMenu
    }
    $global::viewObjectsMenu delete 0 end                                                         ;# completely refresh the sub-menu
    if {[info exists databaseInstances::singleton]} {                                                   ;# history mode special case
        set path $widget::($databaseInstances::singleton,path)
        set title [canvasWindowManager::getTitle $global::windowManager $path]
        set page [canvasWindowManager::viewerPage $global::windowManager $databaseInstances::singleton]
        lappend labels($page) $title
        lappend paths($page) $path
    }
    foreach instance $modules::(instances) {                                 ;# note: in modules list, modules are in creation order
        set namespace $modules::instance::($instance,namespace)
        foreach table $dataTable::(list) {                                     ;# note: in tables list, tables are in creation order
            # filter other module tables
            if {$namespace ne [namespace qualifiers [composite::cget $table -data]]} continue
            set path $widget::($table,path)
            if {[catch {set title [canvasWindowManager::getTitle $global::windowManager $path]}]} continue
            set page [canvasWindowManager::viewerPage $global::windowManager $table]                  ;# empty if there are no pages
            lappend labels($page) $title
            lappend paths($page) $path
        }
    }
    foreach viewer $viewer::(list) {                                         ;# note: in viewers list, viewers are in creation order
        set iconic [expr {[classof $viewer] eq "::canvas::iconic"}]
        if {![viewer::manageable $viewer] && !$iconic} continue                                    ;# iconic viewers are not managed
        if {$iconic} {
            set page [canvas::viewer::page $viewer]                                                   ;# empty if there are no pages
        } else {
            set page [canvasWindowManager::viewerPage $global::windowManager $viewer]                 ;# empty if there are no pages
        }
        # note: use lowercase strings as table titles (module names) usually are
        set path $widget::($viewer,path)
        set title {}                                                               ;# most vievers except formulas, peer tables, ...
        catch {set title [canvasWindowManager::getTitle $global::windowManager $path]}
        if {$title ne ""} {
            lappend labels($page) $title                                                                              ;# favor title
        } else {
            lappend labels($page) [string tolower [lindex [underlineAmpersand $::menuLabel(edit,newViewer,[classof $viewer])] 0]]
        }
        lappend paths($page) $path
        if {$iconic} {set icon($path) $viewer}                             ;# iconic vievers need special treatment so remember them
    }
    if {![info exists paths]} {                                                                                   ;# nothing to view
        [winfo parent $global::viewObjectsMenu] entryconfigure $global::viewObjectsMenuIndex -state disabled
        return
    }
    [winfo parent $global::viewObjectsMenu] entryconfigure $global::viewObjectsMenuIndex -state normal
    foreach page [lsort -integer [array names paths]] {                                                         ;# in creation order
        if {$page eq ""} {
            set menuPath $global::viewObjectsMenu
            set raisePage list                                                                                       ;# does nothing
        } else {                                                                                          ;# there are several pages
            if {![info exist menu($page)]} {
                set menu($page) [menu $global::viewObjectsMenu.$page -tearoff 0]
                $global::viewObjectsMenu add cascade -label [composite::cget $page -label] -menu $menu($page)
            }
            set menuPath $menu($page)
            set raisePage "$pages::(book) see $page; $pages::(book) raise $page"
        }
        foreach label $labels($page) path $paths($page) {
            if {[info exists icon($path)]} {
                $menuPath add command -label $label -command "$raisePage; canvas::viewer::flash $icon($path)"
            } else {
                $menuPath add command -label $label -command "$raisePage; canvasWindowManager::see $global::windowManager $path"
            }
        }
    }
}
